Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: clarify URI parsing behavior of ProxyAgent constructor #2893

Merged
merged 2 commits into from
Mar 5, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions docs/docs/api/ProxyAgent.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ Returns: `ProxyAgent`
Extends: [`AgentOptions`](Agent.md#parameter-agentoptions)

* **uri** `string | URL` (required) - The URI of the proxy server. This can be provided as a string, as an instance of the URL class, or as an object with a `uri` property of type string.
If the `uri` is provided as a string or as a `uri` property of type string, it is then parsed into a URL object according to the [WHATWG URL Standard](https://url.spec.whatwg.org).
metcoder95 marked this conversation as resolved.
Show resolved Hide resolved
For detailed information on the parsing process and potential validation errors, please refer to the ["Writing" section](https://url.spec.whatwg.org/#writing) of the WHATWG URL Standard.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
If the `uri` is provided as a string or as a `uri` property of type string, it is then parsed into a URL object according to the [WHATWG URL Standard](https://url.spec.whatwg.org).
For detailed information on the parsing process and potential validation errors, please refer to the ["Writing" section](https://url.spec.whatwg.org/#writing) of the WHATWG URL Standard.
If the `uri` is provided as a string or `uri` is an object with an `uri` attribute of type string, then it will be parsed into an URL object according to the [WHATWG URL Standard](https://url.spec.whatwg.org).
For detailed information on the parsing process and potential validation errors, refer to the ["Writing" section](https://url.spec.whatwg.org/#writing) of the WHATWG URL Standard.

Copy link
Contributor Author

@rossilor95 rossilor95 Mar 2, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @Uzlopak thank you for the suggestion! I have 2 questions about these changes:

  • Can we keep a URL instead of an URL? I think it is the most correct variant (checked with grammar corrector and a web search)
  • Can we keep the term property when referring to the uri object?

Based on these considerations and on your suggested changes, I would change the section as follows:

If the uri is provided as a string or uri is an object with an uri property of type string, then it will be parsed into a URL object according to the WHATWG URL Standard.
For detailed information on the parsing process and potential validation errors, refer to the "Writing" section of the WHATWG URL Standard.

What do you think? Thank you in advance 😄

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done 😉

metcoder95 marked this conversation as resolved.
Show resolved Hide resolved
* **token** `string` (optional) - It can be passed by a string of token for authentication.
* **auth** `string` (**deprecated**) - Use token.
* **clientFactory** `(origin: URL, opts: Object) => Dispatcher` (optional) - Default: `(origin, opts) => new Pool(origin, opts)`
Expand Down