Allow request headers to be set in requestOptions for a Server
This commit is contained in:
parent
7ec1c60bc5
commit
cba6c6201c
@ -33,6 +33,13 @@ function makeRequest(geturl, options, callback) {
|
|||||||
requestOpt.auth = options.auth;
|
requestOpt.auth = options.auth;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (options.headers) {
|
||||||
|
Object.keys(options.headers).forEach(key => {
|
||||||
|
const value = options.headers[key];
|
||||||
|
requestOpt.headers[key] = value;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
const req = requester(requestOpt, function(resp) {
|
const req = requester(requestOpt, function(resp) {
|
||||||
const contentType = (resp.headers['content-type'] || '').split(';')[0];
|
const contentType = (resp.headers['content-type'] || '').split(';')[0];
|
||||||
if (jsonHeaders.indexOf(contentType) == -1) {
|
if (jsonHeaders.indexOf(contentType) == -1) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user