Fixing Server Information Modal issues
This commit is contained in:
parent
150817d711
commit
4315f47b61
@ -1,3 +1,5 @@
|
|||||||
|
import { Meteor } from 'meteor/meteor';
|
||||||
|
|
||||||
const http = Npm.require('http');
|
const http = Npm.require('http');
|
||||||
const https = Npm.require('https');
|
const https = Npm.require('https');
|
||||||
const url = Npm.require('url');
|
const url = Npm.require('url');
|
||||||
@ -20,7 +22,7 @@ function makeRequest(geturl, options, callback) {
|
|||||||
requester = https.request;
|
requester = https.request;
|
||||||
|
|
||||||
const allowUnauthorizedAgent = new https.Agent({ rejectUnauthorized: false });
|
const allowUnauthorizedAgent = new https.Agent({ rejectUnauthorized: false });
|
||||||
requestOpt.agent = allowUnauthorizedAgent
|
requestOpt.agent = allowUnauthorizedAgent;
|
||||||
} else {
|
} else {
|
||||||
requester = http.request;
|
requester = http.request;
|
||||||
}
|
}
|
||||||
@ -41,8 +43,9 @@ function makeRequest(geturl, options, callback) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const req = requester(requestOpt, function(resp) {
|
const req = requester(requestOpt, function(resp) {
|
||||||
|
// TODO: handle errors with 400+ code
|
||||||
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`;
|
||||||
callback(new Error(errorMessage), null);
|
callback(new Error(errorMessage), null);
|
||||||
return;
|
return;
|
||||||
@ -50,15 +53,16 @@ function makeRequest(geturl, options, callback) {
|
|||||||
|
|
||||||
let output = '';
|
let output = '';
|
||||||
resp.setEncoding('utf8');
|
resp.setEncoding('utf8');
|
||||||
resp.on('data', function(chunk){
|
resp.on('data', function(chunk) {
|
||||||
output += chunk;
|
output += chunk;
|
||||||
});
|
});
|
||||||
resp.on('end', function(){
|
resp.on('end', function() {
|
||||||
callback(null, {data: JSON.parse(output)});
|
callback(null, { data: JSON.parse(output) });
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
req.end();
|
req.end();
|
||||||
}
|
}
|
||||||
|
|
||||||
const makeRequestSync = Meteor.wrapAsync(makeRequest);
|
const makeRequestSync = Meteor.wrapAsync(makeRequest);
|
||||||
|
|
||||||
DICOMWeb.getJSON = function(geturl, options) {
|
DICOMWeb.getJSON = function(geturl, options) {
|
||||||
|
|||||||
@ -1 +1,2 @@
|
|||||||
import './collections';
|
import './collections';
|
||||||
|
import './components';
|
||||||
|
|||||||
@ -8,6 +8,7 @@ Package.onUse(function(api) {
|
|||||||
api.versionsFrom('1.4');
|
api.versionsFrom('1.4');
|
||||||
|
|
||||||
api.use('ecmascript');
|
api.use('ecmascript');
|
||||||
|
api.use('templating');
|
||||||
api.use('jquery');
|
api.use('jquery');
|
||||||
api.use('stylus');
|
api.use('stylus');
|
||||||
api.use('aldeed:simple-schema');
|
api.use('aldeed:simple-schema');
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user