DICOM.getJSON :: making sure contentType is not undefined

This commit is contained in:
Leonardo Campos 2017-03-08 11:08:08 -03:00
parent 30a98559c6
commit 8d4a71fd73

View File

@ -17,7 +17,7 @@ function makeRequest(geturl, options, callback) {
} }
var req = http.request(requestOpt, function(resp) { var req = http.request(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) {
const errorMessage = `We only support json but "${contentType}" was sent by the server`; const errorMessage = `We only support json but "${contentType}" was sent by the server`;