-
Notifications
You must be signed in to change notification settings - Fork 5k
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
web3-providers-http: Migrate from xhr2-cookies to cross-fetch #5179
Conversation
* Update CHANGELOG.md * Migrate from xhr2-cookies to cross-fetch * Address comments for web3-providers-http * web3-providers-http: Prevent global leakage of this.connected * Return server side error without creating additional error object * Fixed type of http.Agent https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-8.html#type-only-imports-and-export * Removed unused variable * Remove unnecessary catch block * Remove unnecessary internal _prepareRequest function from web3-providers-http
Your Render PR Server URL is https://web3-js-pr-5179.onrender.com. Follow its progress at https://dashboard.render.com/static/srv-catfv96hb05gkto4j2t0. |
@@ -46,7 +45,7 @@ export interface HttpProviderOptions { | |||
export class HttpProvider extends HttpProviderBase { | |||
host: string; | |||
|
|||
withCredentials: boolean; | |||
withCredentials?: string; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will be breaking change, why we need it to be string?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can remain consistent with existing 1.x https://web3js.readthedocs.io/en/v1.7.4/web3.html#configuration and have withCredentials
as boolean in web3.js options obj, and based on boolean value provided by user we can pass string to fetch ( include, omit ) here and it will go as fetch wants plus we will not introduce breaking change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jdevcs @nazarhussain Then it should be something more like withCredentials?: boolean | string;
and handle boolean value with if block. Great idea.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jdevcs Please re-review.
Co-authored-by: Junaid <[email protected]>
Pull Request Test Coverage Report for Build 2595964794
💛 - Coveralls |
Description
Created the PR to merge #5085
Type of change
Checklist:
npm run dtslint
with success and extended the tests and types if necessary.npm run test:cov
and my test cases cover all the lines and branches of the added code.npm run build
with success.dist/web3.min.js
in a browser.CHANGELOG.md
file in the root folder.