| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
There was a problem hiding this comment.
Copilot reviewed 14 out of 15 changed files in this pull request and generated 1 comment.
Files not reviewed (1)src/utils.ts:66
return { ...base, ...config.requestOptions, ...(parameters.requestOptions as http.RequestOptions), };
Sorry, something went wrong.
There was a problem hiding this comment.
Copilot reviewed 14 out of 15 changed files in this pull request and generated no comments.
Files not reviewed (1)src/utils.ts:91
resp.on("data", (chunk: Buffer) => {
Sorry, something went wrong.
There was a problem hiding this comment.
Copilot reviewed 14 out of 15 changed files in this pull request and generated no comments.
Files not reviewed (1)src/utils.ts:66
return { ...config.requestOptions, ...(parameters.requestOptions as http.RequestOptions), ...basicOptions };
tests/utils_test.ts:136
const params = { q: "coffee", requestOptions: customOptions } as unknown as qs.ParsedUrlQueryInput;
Sorry, something went wrong.
| }); | ||
| }; | ||
|
|
||
| const req = https.get(options, handleResponse).on("error", handleError); |
There was a problem hiding this comment.
deno task test fails, whereas deno task test:ci passes, I assume this is because we are using https module and it's trying to hit localhost with secure protocol (https)
| const req = https.get(options, handleResponse).on("error", handleError); | |
| const protocolModule = options.protocol === "https" ? https : http; | |
| const req = protocolModule.get(options, handleResponse).on("error", handleError); |
Sorry, something went wrong.
| assertEquals(options.hostname, "serpapi.com"); | ||
| assertEquals(options.port, 443); |
There was a problem hiding this comment.
Let's make this dynamic based on the environment.
Sorry, something went wrong.
| ? { | ||
| hostname: "localhost", | ||
| port: 3000, | ||
| } | ||
| : { | ||
| hostname: "serpapi.com", | ||
| port: 443, | ||
| }; |
There was a problem hiding this comment.
Let's include protocol here
| ? { | |
| hostname: "localhost", | |
| port: 3000, | |
| } | |
| : { | |
| hostname: "serpapi.com", | |
| port: 443, | |
| }; | |
| ? { | |
| hostname: "localhost", | |
| port: 3000, | |
| protocol: "http", | |
| } | |
| : { | |
| hostname: "serpapi.com", | |
| port: 443, | |
| protocol: "https", | |
| }; |
Sorry, something went wrong.
| ? { | ||
| hostname: "localhost", | ||
| port: 3000, | ||
| } | ||
| : { | ||
| hostname: "serpapi.com", | ||
| port: 443, | ||
| }; |
There was a problem hiding this comment.
Let's include protocol here
| ? { | |
| hostname: "localhost", | |
| port: 3000, | |
| } | |
| : { | |
| hostname: "serpapi.com", | |
| port: 443, | |
| }; | |
| ? { | |
| hostname: "localhost", | |
| port: 3000, | |
| protocol: "http", | |
| } | |
| : { | |
| hostname: "serpapi.com", | |
| port: 443, | |
| protocol: "https", | |
| }; |
Sorry, something went wrong.
|
Thanks @Ovi 👍 I removed the test against localhost instead. As this is an open-source repo, not all developers have SerpApi running in localhost. |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Resolves #27
This PR was initially for supporting the proxy feature natively. Unfortunately, HttpsProxyAgent isn't supported in some of the older NodeJS versions that this library promises to support.
As a fallback, this PR allows users to pass their own http.RequestOptions so they can set the agent to be the proxy agent they want.