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

request from defaults() method ignores options argument in some cases. #86

Open
axfree opened this issue Oct 9, 2018 · 1 comment
Open

Comments

@axfree
Copy link

axfree commented Oct 9, 2018

request from defaults() method ignores options argument in some cases.

var request = require('requestretry').defaults({
    headers: {
        'User-Agent': 'default UA'
    }
});

// OK
request('https://github.com/', function (err, response, body) {
});

// NOT OK - Referer header is not sent
request('https://github.com/', {
    headers: {
        Referer: 'https://www.apple.com/'
    }
}, function (err, response, body) {
});

// OK
request({
    url: 'https://github.com/',
    headers: {
        Referer: 'https://www.apple.com/'
    }
}, function (err, response, body) {
});

// OK
request.get('https://github.com/', {
    headers: {
        Referer: 'https://www.apple.com/'
    }
}, function (err, response, body) {
});
@axfree axfree changed the title request from defaults() method ignores default options in some cases. request from defaults() method ignores options in some cases. Oct 9, 2018
@axfree axfree changed the title request from defaults() method ignores options in some cases. request from defaults() method ignores options argument in some cases. Oct 9, 2018
@FGRibreau
Copy link
Owner

Hello @axfree !

I will accept a PR with tests for this :)

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

No branches or pull requests

2 participants