Skip to content

Pass per-request requestOptions in getAccount and *BySearchId functions - #63

Open
Divyanshu-2907 wants to merge 1 commit into
serpapi:masterfrom
Divyanshu-2907:fix/per-request-request-options
Open

Divyanshu-2907 wants to merge 1 commit into
serpapi:masterfrom
Divyanshu-2907:fix/per-request-request-options

Conversation

@Divyanshu-2907

Copy link
Copy Markdown

The README says requestOptions can be passed per request ("Using a proxy" section). That works for getJson, getLocations and the rest, but getAccount, getJsonBySearchId, getHtmlBySearchId and getMdBySearchId only pass api_key and output on to execute. So a per-request proxy agent gets dropped for those four and the request goes out directly, with no error. The global config.requestOptions still works for them.

What this changes:

  • the four functions now pass requestOptions through, same as getJson
  • requestOptions added to the GetBySearchIdParameters, AccountApiParameters and LocationsApiParameters types (getLocations already handled it, the type just didn't have it)
  • execute's parameter type widened so it can take the object; buildRequestOptions already keeps it out of the query string
  • a test for each function that stubs _internals.execute and checks the option arrives, plus a CHANGELOG entry

deno task test and deno lint pass locally.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant