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

"content-length=0" persisting in 302 redirection -> undefined body #604

Closed
SebC99 opened this issue Jul 24, 2013 · 3 comments
Closed

"content-length=0" persisting in 302 redirection -> undefined body #604

SebC99 opened this issue Jul 24, 2013 · 3 comments

Comments

@SebC99
Copy link

SebC99 commented Jul 24, 2013

I request an url with a 302 redirection, and a content-length=0 header. With followRedirect:true and jar:false, request manages to get to the redirection, but keep the content-length=0 header (whereas the server response doesn't include a content-length).
The result is an undefined body instead of the real body.
I guess in that case the content-length header should be undefined or removed, to match the final redirection headers.

If you want to test, here is the requested url (it's a result from google Shopping API) : http://eultech.fnac.com/dynclick/fnac/?etf-publisher=GoogleProducts&etf-name=GoogleProducts_micros&etf-prdref=4245347&eseg-name=referentiel_produit&eseg-item=Fnac&eurl=http://www.fnac.com/Apple-MacBook-Air-Core-i5-a-1-7-GHz-11-6-LED-64-Go-Nouveau/a4245347/w-4?oref=00000000-0000-0000-0000-000000000000&Origin=CMP_GOOGLE_PS_TEK

@SebC99
Copy link
Author

SebC99 commented Jul 24, 2013

I check into request code, and I saw that it deletes content-length on redirect.
So I check my version with npm, and I was on 2.12.0
I tried to update with a npm update request but it kept me the 2.12 so I forced the npm install [email protected] and now it's perfectly working.

@SebC99 SebC99 closed this as completed Jul 24, 2013
@mikeal
Copy link
Member

mikeal commented Jul 24, 2013

npm install request@latest is a good trick.

npm install request will give you the version your package.json says you want.

@SebC99
Copy link
Author

SebC99 commented Jul 29, 2013

I didn't know the @latest trick, thanks!

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

2 participants