Allow request headers to be set in requestOptions for a Server

This commit is contained in:
Erik Ziegler 2017-04-12 11:59:58 +02:00
parent 7ec1c60bc5
commit cba6c6201c

View File

@ -33,6 +33,13 @@ function makeRequest(geturl, options, callback) {
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 contentType = (resp.headers['content-type'] || '').split(';')[0];
if (jsonHeaders.indexOf(contentType) == -1) {