@@ -177,7 +177,7 @@ describe("buildRequestOptions", () => {
177
177
"User-Agent" : "Parameter User Agent" ,
178
178
"X-Custom-Header" : "param-value" ,
179
179
} ,
180
- hostname : "localhost" ,
180
+ agent : true ,
181
181
} ;
182
182
183
183
config . requestOptions = configOptions ;
@@ -191,10 +191,25 @@ describe("buildRequestOptions", () => {
191
191
192
192
assertEquals ( options . headers ?. [ "User-Agent" ] , "Parameter User Agent" ) ;
193
193
assertEquals ( options . headers ?. [ "X-Custom-Header" ] , "param-value" ) ;
194
- assertEquals ( options . hostname , "localhost" ) ;
194
+ assertEquals ( options . agent , true ) ;
195
195
assertEquals ( options . timeout , 5000 ) ;
196
196
assertEquals ( options . path , "/search?q=coffee" ) ;
197
197
} ) ;
198
+
199
+ it ( "basic options are not allowed to be changed" , async ( ) => {
200
+ config . requestOptions = {
201
+ hostname : "localhost" ,
202
+ port : 3000 ,
203
+ path : "/test" ,
204
+ method : "POST" ,
205
+ } ;
206
+
207
+ const options = await buildRequestOptions ( "/search" , { q : "coffee" } ) ;
208
+ assertEquals ( options . hostname , "serpapi.com" ) ;
209
+ assertEquals ( options . port , 443 ) ;
210
+ assertEquals ( options . path , "/search?q=coffee" ) ;
211
+ assertEquals ( options . method , "GET" ) ;
212
+ } ) ;
198
213
} ) ;
199
214
} ) ;
200
215
0 commit comments