@@ -177,7 +177,7 @@ describe("buildRequestOptions", () => {
177177 "User-Agent" : "Parameter User Agent" ,
178178 "X-Custom-Header" : "param-value" ,
179179 } ,
180- hostname : "localhost" ,
180+ agent : true ,
181181 } ;
182182
183183 config . requestOptions = configOptions ;
@@ -191,10 +191,25 @@ describe("buildRequestOptions", () => {
191191
192192 assertEquals ( options . headers ?. [ "User-Agent" ] , "Parameter User Agent" ) ;
193193 assertEquals ( options . headers ?. [ "X-Custom-Header" ] , "param-value" ) ;
194- assertEquals ( options . hostname , "localhost" ) ;
194+ assertEquals ( options . agent , true ) ;
195195 assertEquals ( options . timeout , 5000 ) ;
196196 assertEquals ( options . path , "/search?q=coffee" ) ;
197197 } ) ;
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+ } ) ;
198213 } ) ;
199214} ) ;
200215
0 commit comments