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;
|
return updates;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// retrieves an existing header, case-sensitive
|
||||||
function getHeaderName(reqOpts, header) {
|
function getHeaderName(reqOpts, header) {
|
||||||
var headers = {};
|
var headerNames = {};
|
||||||
Object.keys(reqOpts.headers).forEach(function (key) {
|
Object.keys(reqOpts.headers).forEach(function (casedName) {
|
||||||
headers[key.toLowerCase()] = key;
|
headerNames[casedName.toLowerCase()] = casedName;
|
||||||
});
|
});
|
||||||
// returns the key, which in erroneous cases could be an empty string
|
// 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) {
|
function hasHeader(reqOpts, header) {
|
||||||
return 'undefined' !== typeof getHeaderName(reqOpts, header);
|
return 'undefined' !== typeof getHeaderName(reqOpts, header);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@coolaj86/urequest",
|
"name": "@coolaj86/urequest",
|
||||||
"version": "1.3.5",
|
"version": "1.3.6",
|
||||||
"description": "A lightweight drop-in replacement for request",
|
"description": "A lightweight drop-in replacement for request",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"files": [
|
"files": [
|
||||||
|
|
Loading…
Reference in New Issue