1- import http , { Headers , OptionsOfJSONResponseBody , Response } from "got" ;
1+ import http , { Headers , Options } from "got" ;
22
33export class Request {
44 headers : Headers ;
5- options : OptionsOfJSONResponseBody ;
5+ options : Options ;
66
77 constructor ( ) {
88 this . headers = { "User-Agent" : "keploy-typescript-sdk" } ;
@@ -32,7 +32,7 @@ export class Request {
3232 url : requestUrl ,
3333 method : "GET" ,
3434 headers : this . headers ,
35- responseType : "json " ,
35+ responseType : "buffer " ,
3636 searchParams,
3737 } ;
3838
@@ -49,7 +49,7 @@ export class Request {
4949 url : requestUrl ,
5050 method : "POST" ,
5151 headers : this . headers ,
52- responseType : "json " ,
52+ responseType : "buffer " ,
5353 searchParams,
5454 } ;
5555
@@ -82,7 +82,7 @@ export class Request {
8282 url : requestUrl ,
8383 method : "PUT" ,
8484 headers : this . headers ,
85- responseType : "json " ,
85+ responseType : "buffer " ,
8686 searchParams,
8787 } ;
8888
@@ -99,7 +99,7 @@ export class Request {
9999 url : requestUrl ,
100100 method : "PATCH" ,
101101 headers : this . headers ,
102- responseType : "json " ,
102+ responseType : "buffer " ,
103103 searchParams,
104104 } ;
105105
@@ -136,14 +136,12 @@ export default class HttpClient {
136136 this . baseUrl = baseUrl ;
137137 }
138138
139- async makeHttpRequest < T > ( request : Request ) : Promise < T > {
139+ async makeHttpRequestRaw ( request : Request ) {
140140 const options = { ...request . raw ( ) , prefixUrl : this . baseUrl } ;
141- return http ( options ) . json ( ) ;
142- }
143-
144- async makeHttpRequestRaw < T > ( request : Request ) : Promise < Response < T > > {
145- const options = { ...request . raw ( ) , prefixUrl : this . baseUrl } ;
146- const resp : Response < T > = await http ( options ) ;
147- return resp ;
141+ try {
142+ await http ( options ) ;
143+ } catch ( error ) {
144+ console . log ( error ) ;
145+ }
148146 }
149147}
0 commit comments