Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Looking for a standalone library for handling HTTP cookies on a personal container in Javascript [closed]

Do you know if a Javascript library to handle cookies exists, that is mature and can work without a browser? In other words I only want the cookie logic that is included in the web browsers and HTTP clients and following the current standards, and the cookies are stored and retrieved from a private store.

I think the library can only contain get/set methods. The set method set cookies that came from the "Set-Cookie" HTTP header and the get method returns a list of cookies to send in the "Cookie" header for a specific host (or domain). The get method would need to receive a host as a parameter too, since return an error or something if a host is specifying cookies for another domain. There are more details about cookies that can be nice to have.

I saw questions like Is there an equivalent to the Apache HTTP Client in JavaScript? but the answer works and sets the cookie within a browser and not in a specific container.

Note: I looked into https://github.com/jed/cookies/blob/master/lib/cookies.js , it is the closer library that matches the question right now. The most important issue against it is that there is not a getter for a domain: imagine you want to return all cookies for the yahoo.com domain, this logic is not part of the library and it is one of the most important features for a cookie library to decide which cookies to send in an HTTP request.

like image 271
sw. Avatar asked Jan 29 '26 20:01

sw.


1 Answers

I found a library that answers my question: CookieJar for Node (not bound to HTTP requests). Take into account that the @Barmar comment was related to cookie jar on libcurl.

I found the lib using the following query: site:github.com cookies lib domain secure

like image 62
sw. Avatar answered Feb 01 '26 15:02

sw.



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!