v1.3.6: merge some bugfix PRs

This commit is contained in:
AJ ONeal 2018-07-12 03:12:49 -06:00
parent c880788e9a
commit 49daa68225
2 changed files with 7 additions and 5 deletions

View File

@ -29,14 +29,16 @@ function mergeOrDelete(defaults, updates) {
return updates;
}
// retrieves an existing header, case-sensitive
function getHeaderName(reqOpts, header) {
var headers = {};
Object.keys(reqOpts.headers).forEach(function (key) {
headers[key.toLowerCase()] = key;
var headerNames = {};
Object.keys(reqOpts.headers).forEach(function (casedName) {
headerNames[casedName.toLowerCase()] = casedName;
});
// returns the key, which in erroneous cases could be an empty string
return headers[header.toLowerCase()];
return headerNames[header.toLowerCase()];
}
// returns whether or not a header exists, case-insensitive
function hasHeader(reqOpts, header) {
return 'undefined' !== typeof getHeaderName(reqOpts, header);
}

View File

@ -1,6 +1,6 @@
{
"name": "@coolaj86/urequest",
"version": "1.3.5",
"version": "1.3.6",
"description": "A lightweight drop-in replacement for request",
"main": "index.js",
"files": [