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
removeRefererHeader docs #1858
Comments
Can you provide a short example or a failing test? Here is the current test regarding that behavior. |
ok, I'll do it soon |
Also note that earlier today I submitted another PR attemting to fix the referer header behavior #1857 |
if add referer header in test you selected it fails: tape('should not have a referer when removeRefererHeader is true', function(t) {
request.post({
uri: s.url + '/temp',
jar: jar,
followAllRedirects: true,
removeRefererHeader: true,
headers: { cookie: 'foo=bar', referer: 'http://example.com' }
}, function(err, res, body) {
t.equal(err, null)
t.equal(res.statusCode, 200)
t.end()
})
.on('redirect', function() {
t.equal(this.headers.referer, undefined)
})
})
so it hasn't removed the referer header as documentation says |
Right, now I see. As I understand it, the intention was probably to actually remove it. So instead of having: if (!self.removeRefererHeader) {
request.setHeader('referer', uriPrev.href)
} It should be: if (self.removeRefererHeader) {
request.removeHeader('referer')
} else {
request.setHeader('referer', uriPrev.href)
} Of course the test should be fixed too. What do you think? |
I think that current version of |
Yep, I think the current implementation is good. We just need additional test for the case when you manually set the referer header in the initial request. I think I'm going to add one tomorrow. As for the docs, I'm open for suggestions:
|
👍 little suggestion:
(added "if true" and "chain") |
Fixed in #1860 |
in documentation:
but actually it doesn't remove Referer, it just reuses its value from initial request(like browsers behave). I guess that need to do some corrections in docs about this option.
The text was updated successfully, but these errors were encountered: