1
- import http , { Headers , OptionsOfJSONResponseBody , Response } from "got" ;
1
+ import http , { Headers , Options } from "got" ;
2
2
3
3
export class Request {
4
4
headers : Headers ;
5
- options : OptionsOfJSONResponseBody ;
5
+ options : Options ;
6
6
7
7
constructor ( ) {
8
8
this . headers = { "User-Agent" : "keploy-typescript-sdk" } ;
@@ -32,7 +32,7 @@ export class Request {
32
32
url : requestUrl ,
33
33
method : "GET" ,
34
34
headers : this . headers ,
35
- responseType : "json " ,
35
+ responseType : "buffer " ,
36
36
searchParams,
37
37
} ;
38
38
@@ -49,7 +49,7 @@ export class Request {
49
49
url : requestUrl ,
50
50
method : "POST" ,
51
51
headers : this . headers ,
52
- responseType : "json " ,
52
+ responseType : "buffer " ,
53
53
searchParams,
54
54
} ;
55
55
@@ -82,7 +82,7 @@ export class Request {
82
82
url : requestUrl ,
83
83
method : "PUT" ,
84
84
headers : this . headers ,
85
- responseType : "json " ,
85
+ responseType : "buffer " ,
86
86
searchParams,
87
87
} ;
88
88
@@ -99,7 +99,7 @@ export class Request {
99
99
url : requestUrl ,
100
100
method : "PATCH" ,
101
101
headers : this . headers ,
102
- responseType : "json " ,
102
+ responseType : "buffer " ,
103
103
searchParams,
104
104
} ;
105
105
@@ -136,14 +136,12 @@ export default class HttpClient {
136
136
this . baseUrl = baseUrl ;
137
137
}
138
138
139
- async makeHttpRequest < T > ( request : Request ) : Promise < T > {
139
+ async makeHttpRequestRaw ( request : Request ) {
140
140
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
+ }
148
146
}
149
147
}
0 commit comments