Skip to content
This repository was archived by the owner on Mar 5, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -617,3 +617,4 @@ Released with 1.0.0-beta.37 code base.
### Fixed

- Fixed types for `web3.utils._jsonInterfaceMethodToString` (#5550)
- Fixed Next.js builds failing on Node.js v16, Abortcontroller added if it doesn't exist globally (#5601)
6 changes: 5 additions & 1 deletion packages/web3-providers-http/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,11 @@ var https = require('https');
// Apply missing polyfill for IE
require('cross-fetch/polyfill');
require('es6-promise').polyfill();
require('abortcontroller-polyfill/dist/polyfill-patch-fetch');

// import abortController if abortController is not included in node
if(typeof global !== "undefined" && !global.AbortController){
require('abortcontroller-polyfill/dist/polyfill-patch-fetch')
}

/**
* HttpProvider should be used to send rpc calls over http
Expand Down
2 changes: 2 additions & 0 deletions test/httpprovider.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,12 @@ describe('web3-providers-http', function () {

describe('send', function () {
it('should fail with invalid remote node connection', async function () {

var provider = new HttpProvider('http://localhost:8545');
var web3 = new Web3(provider);

await expect(web3.eth.getChainId()).to.be.rejectedWith(Error, "CONNECTION ERROR: Couldn't connect to node http://localhost:8545.");

});

it('should fail for non-json format response', async function () {
Expand Down