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

error response after a 'redirect after post' #800

Closed
mu-yu opened this issue Mar 28, 2017 · 1 comment
Closed

error response after a 'redirect after post' #800

mu-yu opened this issue Mar 28, 2017 · 1 comment

Comments

@mu-yu
Copy link

mu-yu commented Mar 28, 2017

image

axios({
      method: 'post',
      url: url,
      data: querystring.stringify(formData),
      headers: {
        'Content-Type': 'application/x-www-form-urlencoded'
      }
    }).then(response => {
      console.log(response)
    }).catch(err => {
      console.log(err)
    })

The code above will fail with code 504, what i want is response with code 302 or auto redirect.

request do what i want

request.post({url: url, form: formData/*, followAllRedirects: true*/}, (err,httpResponse,body) => {
      console.log(httpResponse.headers)
})
@rubennorte
Copy link
Member

Redirects are automatically followed by browsers so you can never get the original 302. It seems that you're server is returning that 504 for the second request.

@axios axios locked and limited conversation to collaborators May 22, 2020
shreem-123 added a commit to shreem-123/axios that referenced this issue Oct 27, 2022
spelling correction
jasonsaayman added a commit that referenced this issue Oct 30, 2022
spelling correction

Co-authored-by: Jay <jasonsaayman@gmail.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants