diff --git a/Packages/ohif-dicom-services/server/DICOMWeb/getJSON.js b/Packages/ohif-dicom-services/server/DICOMWeb/getJSON.js index 82d2c95bc..d6f17e515 100644 --- a/Packages/ohif-dicom-services/server/DICOMWeb/getJSON.js +++ b/Packages/ohif-dicom-services/server/DICOMWeb/getJSON.js @@ -1,3 +1,5 @@ +import { Meteor } from 'meteor/meteor'; + const http = Npm.require('http'); const https = Npm.require('https'); const url = Npm.require('url'); @@ -20,7 +22,7 @@ function makeRequest(geturl, options, callback) { requester = https.request; const allowUnauthorizedAgent = new https.Agent({ rejectUnauthorized: false }); - requestOpt.agent = allowUnauthorizedAgent + requestOpt.agent = allowUnauthorizedAgent; } else { requester = http.request; } @@ -41,8 +43,9 @@ function makeRequest(geturl, options, callback) { } const req = requester(requestOpt, function(resp) { + // TODO: handle errors with 400+ code 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`; callback(new Error(errorMessage), null); return; @@ -50,15 +53,16 @@ function makeRequest(geturl, options, callback) { let output = ''; resp.setEncoding('utf8'); - resp.on('data', function(chunk){ - output += chunk; + resp.on('data', function(chunk) { + output += chunk; }); - resp.on('end', function(){ - callback(null, {data: JSON.parse(output)}); + resp.on('end', function() { + callback(null, { data: JSON.parse(output) }); }); }); req.end(); } + const makeRequestSync = Meteor.wrapAsync(makeRequest); DICOMWeb.getJSON = function(geturl, options) { diff --git a/Packages/ohif-servers/client/index.js b/Packages/ohif-servers/client/index.js index 20b848c68..1a0a81c4b 100644 --- a/Packages/ohif-servers/client/index.js +++ b/Packages/ohif-servers/client/index.js @@ -1 +1,2 @@ import './collections'; +import './components'; diff --git a/Packages/ohif-servers/package.js b/Packages/ohif-servers/package.js index 8dec73d60..574de1674 100644 --- a/Packages/ohif-servers/package.js +++ b/Packages/ohif-servers/package.js @@ -8,6 +8,7 @@ Package.onUse(function(api) { api.versionsFrom('1.4'); api.use('ecmascript'); + api.use('templating'); api.use('jquery'); api.use('stylus'); api.use('aldeed:simple-schema');