Skip to content
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

how to add cookie header with picasso? #1259

Closed
kkwsl opened this issue Jan 11, 2016 · 4 comments
Closed

how to add cookie header with picasso? #1259

kkwsl opened this issue Jan 11, 2016 · 4 comments

Comments

@kkwsl
Copy link

kkwsl commented Jan 11, 2016

OkHttpClient tmp = client.clone();
tmp.networkInterceptors().add(new Interceptor() {
@OverRide
public Response intercept(Chain chain) throws IOException {
Request request = chain.request().newBuilder().addHeader("Cookie", mCookieStr).build();
return chain.proceed(request);
}
});
mPicasso = new Picasso.Builder(mContext).downloader(new OkHttpDownloader(tmp)).build();

i use these code,but not work

@gwokwong
Copy link

I also encountered this problem, is looking for solutions

@kkwsl
Copy link
Author

kkwsl commented Jan 21, 2016

finally i find maybe sth wrong with my url, but the url can display on the web

@gwokwong
Copy link

this is my blog http://blog.csdn.net/guowang_wei/article/details/50536987 .
Code is very simple

At 2016-01-21 09:06:29, "kkwsl" notifications@github.com wrote:

finally i find maybe sth wrong with my url, but the url can display on the web


Reply to this email directly or view it on GitHub.

@JakeWharton
Copy link
Member

For UrlConnectionDownloader you can override load(Uri), call super, and add a header to the returned HttpURLConnection.

For OkHttpDownloader and OkHttp3Downloader you need can add an interceptor to add the header or configure the OkHttpClient to use cookies. See OkHttp's wiki and javadoc for instructions on how to do that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants