import * as request from "request" ; import HttpClientResponseInterface from "./../interfaces/HttpClientResponseInterface" ; export default class HttpClient { public call ( options ) { return new Promise < HttpClientResponseInterface > ( ( resolve , reject ) => { request ( options , ( error , response , body ) => { if ( error ) { return reject ( error ) ; } if ( body ) { try { body = JSON . parse ( body ) ; } catch ( error ) { } } resolve ( { body , headers : response . headers , status : response . statusCode , } ) ; } ) ; } ) ; } }