tomas / needle

Nimble, streamable HTTP client for Node.js. With proxy, iconv, cookie, deflate & multipart support.
https://www.npmjs.com/package/needle
MIT License
1.63k stars 236 forks source link

Add `follow_if_different_location` config #300

Closed laurent35240 closed 4 years ago

laurent35240 commented 4 years ago

I added follow_if_different_location in order to be able to decide if we want to process redirect if location in the same.

We have example of websites redirecting with same location but with different cookies and so not ending with a redirection loop. So in this case we do not want to stop redirections.

tomas commented 4 years ago

Looks good, thanks. I'm thinking it's clearer to say follow_if_same_location (default: false) than the opposite. What do you think?

laurent35240 commented 4 years ago

I chose follow_if_different_location in order to have consistent explanation of configuration in README. To always have something like When true, Needle will only follow redirects that...

But if you really prefer follow_if_same_location, sure I can change it.

Let me know

laurent35240 commented 4 years ago

Hi

@tomas Any chance that this pull request will be merged soon?

tomas commented 4 years ago

If you can change the param to follow_if_same_location I'll merge it. It seems to make more sense considering the other options:

image

laurent35240 commented 4 years ago

OK it is changed