node-request-retry icon indicating copy to clipboard operation
node-request-retry copied to clipboard

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

Open axfree opened this issue 7 years ago • 1 comments

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 avatar Oct 09 '18 19:10 axfree

Hello @axfree !

I will accept a PR with tests for this :)

FGRibreau avatar Oct 10 '18 07:10 FGRibreau