Skip to content

error response after a 'redirect after post' #800

Closed
@mu-yu

Description

@mu-yu

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)
})

Activity

rubennorte

rubennorte commented on Apr 2, 2017

@rubennorte
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.

locked and limited conversation to collaborators on May 22, 2020
added a commit that references this issue on Oct 27, 2022
8d8ec6f
added a commit that references this issue on Oct 30, 2022
34811cb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @rubennorte@mu-yu

        Issue actions

          error response after a 'redirect after post' · Issue #800 · axios/axios