Add support java.net.HttpCookie for request
It is more convenient to use java.net.HttpCookie because I can specify only name and value for the request. Also it is standard class.
No. AHC's cookie class and parser are optimized and don't target stone age RFC 2965.
From java.net.HttpCookie's javadoc:
There are 3 HTTP cookie specifications:
- Netscape draft
- RFC 2109 http://www.ietf.org/rfc/rfc2109.txt
- RFC 2965 http://www.ietf.org/rfc/rfc2965.txt
HttpCookie class can accept all these 3 forms of syntax.
All modern browsers and frameworks target RFC 6265.
According to RFC 6265: == User Agent -> Server == Cookie: SID=31d4d96e407aad42 But now if I want to add my own Cookie to the request I have only constructor with all fields: https://github.com/AsyncHttpClient/async-http-client/blob/master/client/src/main/java/org/asynchttpclient/cookie/Cookie.java#L19 Maybe it could be possible to add constructor with less amount of parameters?
No:
Cookieis immutable, which is a proper design (on contrary toHttpCookiewhich isn't)- constructor overloading is quickly a huge mess to deal with every possible default value combination
The proper solution would be to have a mutable builder. Feel free to contribute one.