-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Have a CookieJar #1235
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
No, AHC doesn't provide a cookie jar.
Contribs welcome
You have the responses where you can fetch the Set-Cookie header, fetch those and use them to craft the next requests. |
Thanks for the answers.
That is exactly what i am doing now. Maybe as interim solution, add a line to API doc or github homepage? |
…, now handling cookies as a Set instead of List
No contrib so far. Closing for now. |
Note for potential contributor: you can have a look at https://github.com/gatling/gatling/blob/master/gatling-http/src/main/scala/io/gatling/http/cookie/CookieJar.scala for an example. Main difference is AHC would need a thread safe implementation (most likely ConcurrentHashMap based). |
@slandelle Could you please tell me what aspect exactly of implementation of CookieJar use provided above in Diagoras@96747f9 you consider incorrect ? |
Sadly, all of it: it doesn't implement anything from the RFC6265 spec, such as domain and path matching. |
Hi,
I am using this lib for testing a custom REST server based on Netty 4.1. 4, the latest, using Scala.
I need to test that cookie has been set correctly at sever side and can be parsed correct on next request.
I used a single DefaultAsyncHttpClient object to submit the first round of request and it received server set cookies successfully.
The cookies from server were correctly returned.
Then I used the same DefaultAsyncHttpClient object to submit another request. I supposed the cookies be sent to server automatically. But the netty server was never able to get the cookies from the requests.
Then i tried in the next request by explicitly setting cookies.
val request2: Request = (new RequestBuilder("GET")).
setUrl("http://127.0.0.1:9090/developer").
setCookies(cookies).
build()
This time the netty server can parse the cookies correctly.
I am wondering if it is by design that DefaultAsyncHttpClient will not send server side cookies in next round of request.
If so, I suggest to add the support to coming versions.
If not, what's the correct way to use this feature, which is very useful for my case.
Thanks
The text was updated successfully, but these errors were encountered: