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

fixes for redirect not preserving body with followOriginalHttpMethod #2608 #2645

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

tpae
Copy link

@tpae tpae commented Apr 19, 2017

This PR fixes #2608.

Problem occurs when setting followOriginalHttpMethod to true, request body is not preserved and is not passed with the redirect.

Steps to reproduce is outlined by @mirkods in #2608. I've added additional cases to verify the changes. It should be a minimal change, with very little impact.

PR Checklist:

PR Description

I modified redirect logic to preserve body, content type, and content length when followOriginalHttpMethod is set to true.

@mirkods
Copy link
Contributor

mirkods commented Apr 20, 2017

Well done @tpae, hope it will be merged soon!

@mirkods
Copy link
Contributor

mirkods commented Jan 25, 2018

Guys any news on this?

@tpae
Copy link
Author

tpae commented Jan 25, 2018

Not sure. I ended up switching to axios

@Lorenzovds
Copy link

@mikeal could we get this merged? 😄

@siddhuwarrier
Copy link

Hey guys, hello from Cisco Meraki, and we're running into the same issue with Cisco-internal integrations! Getting this PR merged would be amazing, as with this HTTP 308 will behave according to specification. :-)

@codenirvana
Copy link

@tpae I feel this feature(support for 308 Permanent Redirect) should be independent offollowOriginalHttpMethod option. It should be handled by default(as per RFC) just like 307.
A possible side effect of this implementation will be, the body will be sent even for non 307 or 308 redirects which violate the RFC.

I fixed this in our fork recently.

However, there's another issue which you will face i.e, FormData bodies are lost on redirection.
So, I reinitialize the request._form stream which works for text and file form values but it drops other streams(request, http etc).

cc. @reconbot @mikeal

@pkuczaj
Copy link

pkuczaj commented Dec 4, 2019

Any progress on the decision to merge this PR?

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

Successfully merging this pull request may close these issues.

Redirect with followOriginalHttpMethod:true does not mantain the original body
7 participants