@@ -11,7 +11,7 @@ import { common, generateGPGKeyPair } from '@bitgo/sdk-core';
1111import { bip32 , ECPair } from '@bitgo/utxo-lib' ;
1212import * as _ from 'lodash' ;
1313import * as BitGoJS from '../../src/index' ;
14- const rp = require ( 'request-promise' ) ;
14+ import axios from 'axios' ;
1515
1616import { TestBitGo } from '@bitgo/sdk-test' ;
1717import { BitGo } from '../../src/bitgo' ;
@@ -473,27 +473,26 @@ describe('BitGo Prototype Methods', function () {
473473 timestamp : '1521590532925' ,
474474 } ) ;
475475
476- const responseData = ( await rp ( {
477- uri : url ,
478- method : 'GET' ,
476+ const response = await axios . get ( url , {
479477 headers : requestHeaders ,
480- transform : ( body , response ) => {
481- // verify the response headers
482- const url = response . request . href ;
483- const hmac = response . headers . hmac ;
484- const timestamp = response . headers . timestamp ;
485- const statusCode = response . statusCode ;
486- const verificationParams = {
487- url,
488- hmac,
489- timestamp,
490- token,
491- statusCode,
492- text : body ,
493- } ;
494- return bitgo . verifyResponse ( verificationParams ) ;
495- } ,
496- } ) ) as any ;
478+ transformResponse : [ ] ,
479+ } ) ;
480+
481+ const finalUrl = response . request . responseURL || url ;
482+ const hmac = response . headers . hmac ;
483+ const timestamp = response . headers . timestamp ;
484+ const statusCode = response . status ;
485+
486+ const verificationParams = {
487+ url : finalUrl ,
488+ hmac,
489+ timestamp,
490+ token,
491+ statusCode,
492+ text : response . data ,
493+ } ;
494+
495+ const responseData = bitgo . verifyResponse ( verificationParams ) as any ;
497496 responseData . signatureSubject . should . equal (
498497 '1521590532925|/api/v2/tltc/wallet/5941b202b42fcbc707170d5b597491d9/address/QNc4RFAcbvqmtrR1kR2wbGLCx6tEvojFYE?segwit=1|200|{"id":"5a7ca8bcaf52c8e807c575fb692609ec","address":"QNc4RFAcbvqmtrR1kR2wbGLCx6tEvojFYE","chain":0,"index":2,"coin":"tltc","wallet":"5941b202b42fcbc707170d5b597491d9","coinSpecific":{"redeemScript":"522102835bcfd130f7a56f72c905b782d90b66e22f88ad3309cf72af5138a7d44be8b3210322c7f42a1eb212868eab78db7ba64846075d98c7f4c7aa25a02e57871039e0cd210265825be0d5bf957fb72abd7c23bf0836a78a15f951a073467cd5c99e03ce7ab753ae"},"balance":{"updated":"2018-02-28T23:48:07.341Z","numTx":1,"numUnspents":1,"totalReceived":20000000}}'
499498 ) ;
0 commit comments