Implement okhttp3.CookieJar
swankjesse opened this issue · 6 comments
It'd be neat if y'all implemented CookieJar and stopped depending on the okhttp-urlconnection artificact that's necessary to integrate java.net APIs.
@swankjesse sure, it's on schedule 😃. First step is to simply copy existing JavaNetCookieJar from current OkHttp. Any suggestion is greatly appreciated!
Yep, that’s a great first place to start. Once you’re there I recommend using HttpUrl
internally rather than java.net.URI
. The HttpUrl
class supports more URLs than java.net.URI
and so conversion is sometimes awkward.
@swankjesse done! You can take a look here: https://github.com/gotev/android-cookie-store/blob/master/cookie-store-okhttp/src/main/java/net/gotev/cookiestore/okhttp/JavaNetCookieJar.kt
This is now a separate java artifact, usable on both pure JVM and Android. Waiting for jCenter indexing to make it public.
Removed all the okhttp3.internal
imports (by copying needed code) except okhttp3.internal.cookieToString
. Any suggestion?
Copy that method in too!
Ended up copying the whole internal toString(forObsoleteRfc2965: Boolean)
method from Cookie
and a bunch of other stuff. No imports from okhttp3.internal
anymore! 🎉 Version 1.2.1
is now public!
@swankjesse Just out of curiosity, I know RFC 2965 is obsolete, but why making the toString(forObsoleteRfc2965: Boolean)
method internal only, but with a publicly accessible extension cookieToString
? Wouldn't it be easier to just make it public?
It's intended to be public-to-OkHttp, not public to the world. That's what the internal package is attempting!