Fix redirections #564

Merged
merged 1 commit into from May 31, 2013

Projects

None yet

2 participants

@criloz
Contributor
criloz commented May 31, 2013

The problem

Request module was ignoring the new location

Why:

when there are a new redirection self.uri is set to the new location

self.uri = url.parse(redirectTo)

after that again , call the init function with this

if (self.url ) {
    // People use this property instead all the time so why not just support it.
    self.uri = self.url
    delete self.url
  }

so the location is ignored, have not effect, and the second request is done to the original url

solution

if (self.url && !self.uri) {
    // People use this property instead all the time so why not just support it.
    self.uri = self.url
    delete self.url
  }

Regards

@criloz criloz Fix redirections,
they were having no effect, the module was ignoring the new location
3040bbe
@mikeal mikeal merged commit 7f4781f into request:master May 31, 2013
@mikeal
Member
mikeal commented May 31, 2013

great bug, can't believe we just now found it. thanks for the fix :)

@criloz
Contributor
criloz commented May 31, 2013

๐Ÿ‘

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