v1.3.6: merge some bugfix PRs
This commit is contained in:
parent
c880788e9a
commit
49daa68225
10
index.js
10
index.js
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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": [
|
||||
|
|
Loading…
Reference in New Issue