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

Invalid Headers when using Unirest #97

Closed
artguy10 opened this issue Jun 6, 2015 · 5 comments
Closed

Invalid Headers when using Unirest #97

artguy10 opened this issue Jun 6, 2015 · 5 comments

Comments

@artguy10
Copy link

artguy10 commented Jun 6, 2015

Unirest.post("https://dweet.io/dweet").fields(map).asJson(); // map is a HashMap of course

I am making a standard POST request to a server and I get the following while receiving a response.

Jun 06, 2015 4:36:18 PM org.apache.http.client.protocol.ResponseProcessCookies processCookies
WARNING: Invalid cookie header: "Set-Cookie: dweet:thing=hallowed-mailbox; path=/; expires=Sun,
05 Jun 2016 20:36:16 GMT; httponly". Invalid 'expires' attribute: Sun, 05 Jun 2016 20:36:16 GMT

Can someone please help me fix this frustrating error? I love Unirest, it's like requests but in Java too!

@artguy10 artguy10 changed the title Invalid Apache Headers when using Unires Invalid Headers when using Unirest Jun 6, 2015
@jthomas
Copy link

jthomas commented Jan 6, 2016

I encountered the same problem and found a solution:

RequestConfig globalConfig = RequestConfig.custom()
.setCookieSpec(CookieSpecs.IGNORE_COOKIES).build();
        
HttpClient httpclient = HttpClients.custom().setDefaultRequestConfig(globalConfig).build();
Unirest.setHttpClient(httpclient);

@maniankara
Copy link

Thanks for the response, Wondering is there a way to fix it than just IGNORING cookies/warnings?

@clickear
Copy link

CookieSpecs.IGNORE_COOKIES: just IGNORING cookies
CookieSpecs.STANDARD: will parse Invalid 'expires';The RFC 6265 compliant policy (interoprability profile).
see http://hc.apache.org/httpcomponents-client-ga/httpclient/apidocs/org/apache/http/client/config/CookieSpecs.html

@ryber
Copy link
Collaborator

ryber commented Mar 6, 2019

Hello, this should be resolved or addressed in Unirest 2. Please see the upgrade guide for important changes.

@Mailaender
Copy link

Unirest.config().cookieSpec("standard");

solved it for me.

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

6 participants