Skip to content
This repository was archived by the owner on Mar 5, 2025. It is now read-only.

web3-providers-http: Migrate from xhr2-cookies to cross-fetch#5179

Merged
nazarhussain merged 7 commits into
1.xfrom
nh/cross-fetch-update
Jul 1, 2022
Merged

web3-providers-http: Migrate from xhr2-cookies to cross-fetch#5179
nazarhussain merged 7 commits into
1.xfrom
nh/cross-fetch-update

Conversation

@nazarhussain
Copy link
Copy Markdown
Contributor

Description

Created the PR to merge #5085

Type of change

  • Bug fix (non-breaking change which fixes an issue)

Checklist:

  • I have selected the correct base branch.
  • I have performed a self-review of my own code.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have made corresponding changes to the documentation.
  • My changes generate no new warnings.
  • Any dependent changes have been merged and published in downstream modules.
  • I ran npm run dtslint with success and extended the tests and types if necessary.
  • I ran npm run test:cov and my test cases cover all the lines and branches of the added code.
  • I ran npm run build with success.
  • I have tested the built dist/web3.min.js in a browser.
  • I have tested my code on the live network.
  • I have checked the Deploy Preview and it looks correct.
  • I have updated the CHANGELOG.md file in the root folder.

* 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
@render
Copy link
Copy Markdown

render Bot commented Jun 28, 2022

@nazarhussain nazarhussain changed the title web3-providers-http: Migrate from xhr2-cookies to cross-fetch (#5085) web3-providers-http: Migrate from xhr2-cookies to cross-fetch Jun 28, 2022
@nazarhussain nazarhussain self-assigned this Jun 28, 2022
@nazarhussain nazarhussain added the 1.x 1.0 related issues label Jun 28, 2022
host: string;

withCredentials: boolean;
withCredentials?: string;
Copy link
Copy Markdown
Contributor

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?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Contributor

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.

Copy link
Copy Markdown

@ghost ghost Jul 1, 2022

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@jdevcs Please re-review.

Comment thread packages/web3-providers-http/src/index.js Outdated
@nazarhussain
Copy link
Copy Markdown
Contributor Author

@jdevcs This PR contains only the package-lock.json changes. Rest of these comes from the community PR #5085. Opened here to pass the browsers tests.

Co-authored-by: Junaid <86780488+jdevcs@users.noreply.github.com>
@nazarhussain nazarhussain requested a review from jdevcs June 29, 2022 14:51
Comment thread test/httpprovider.js Outdated
@coveralls
Copy link
Copy Markdown

coveralls commented Jul 1, 2022

Pull Request Test Coverage Report for Build 2595964794

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • 21 unchanged lines in 1 file lost coverage.
  • Overall coverage decreased (-0.2%) to 74.326%

Files with Coverage Reduction New Missed Lines %
packages/web3-providers-http/lib/index.js 21 63.64%
Totals Coverage Status
Change from base Build 2590161082: -0.2%
Covered Lines: 3257
Relevant Lines: 4132

💛 - Coveralls

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

Labels

1.x 1.0 related issues Future Release For future release.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants