File tree Expand file tree Collapse file tree 3 files changed +10
-2
lines changed
Expand file tree Collapse file tree 3 files changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ describe('Routes', () => {
1212
1313 describe ( 'Health Check Routes' , ( ) => {
1414 it ( 'should return 200 and status message for /ping' , async ( ) => {
15- const response = await request ( app ) . get ( '/ping' ) ;
15+ const response = await request ( app ) . post ( '/ping' ) ;
1616 expect ( response . status ) . toBe ( 200 ) ;
1717 expect ( response . body ) . toHaveProperty ( 'status' , 'enclaved express server is ok!' ) ;
1818 expect ( response . body ) . toHaveProperty ( 'timestamp' ) ;
Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ import * as superagent from 'superagent';
22import debug from 'debug' ;
33import { config } from '../config' ;
44import { isMasterExpressConfig } from '../types' ;
5+ import https from 'https' ;
56
67const debugLogger = debug ( 'bitgo:express:enclavedExpressClient' ) ;
78
@@ -25,6 +26,7 @@ export class EnclavedExpressClient {
2526 private readonly url : string ;
2627 private readonly sslCert : string ;
2728 private readonly coin ?: string ;
29+ private readonly enableSSL : boolean ;
2830
2931 constructor ( coin ?: string ) {
3032 const cfg = config ( ) ;
@@ -41,6 +43,7 @@ export class EnclavedExpressClient {
4143 this . url = cfg . enclavedExpressUrl ;
4244 this . sslCert = cfg . enclavedExpressSSLCert ;
4345 this . coin = coin ;
46+ this . enableSSL = ! ! cfg . enableSSL ;
4447 debugLogger ( 'EnclavedExpressClient initialized with URL: %s' , this . url ) ;
4548 }
4649
@@ -69,6 +72,12 @@ export class EnclavedExpressClient {
6972 const { body : keychain } = await superagent
7073 . post ( `${ this . url } /api/${ this . coin } /key/independent` )
7174 . ca ( this . sslCert )
75+ . agent (
76+ new https . Agent ( {
77+ rejectUnauthorized : this . enableSSL ,
78+ ca : this . sslCert ,
79+ } ) ,
80+ )
7281 . type ( 'json' )
7382 . send ( params ) ;
7483 return keychain ;
Original file line number Diff line number Diff line change @@ -23,7 +23,6 @@ import {
2323 readCertificates ,
2424 setupHealthCheckRoutes ,
2525} from './shared/appUtils' ;
26- import { ApiResponseError } from './errors' ;
2726import bodyParser from 'body-parser' ;
2827import { ProxyAgent } from 'proxy-agent' ;
2928import { promiseWrapper } from './routes' ;
You can’t perform that action at this time.
0 commit comments