dakrone / clj-http

An idiomatic clojure http client wrapping the apache client. Officially supported version.
http://clojars.org/clj-http
MIT License
1.78k stars 408 forks source link

Is there a way to check if a cookie has the flag HttpOnly? #513

Closed mourjo closed 5 years ago

mourjo commented 5 years ago

For example, the cookie in this test file has the attribute HttpOnly https://github.com/dakrone/clj-http/blob/070e34a783e4c477bdb9bec3010b7b135ce22de8/test/clj_http/test/core_test.clj#L135

I was wondering if there is a way to extract it when I pass a CookieStore to requests. This is not returned by default when I use get-cookies, I didn't find a way this can be done in ClientCookie either, wondering if I am missing something.

rdivyanshu commented 5 years ago

I don't know if it solves your problem but to check cookie has attribute HttpOnly, you need to call (.containsAttribute ^ClientCookie cookie "httponly")

Reason for lowercase is when setting attributes it is lower cased https://github.com/apache/httpcomponents-client/blob/master/httpclient5/src/main/java/org/apache/hc/client5/http/impl/cookie/CookieSpecBase.java#L107

mourjo commented 5 years ago

@rdivyanshu yes it does! Thanks a lot!