Skip to content

Commit

Permalink
Merge pull request #3509 from ethereum/issue/3508
Browse files Browse the repository at this point in the history
Fix WSS credentials Base64 encoding (for browser)
  • Loading branch information
ryanio authored May 8, 2020
2 parents 697b40f + 488b7c2 commit d543605
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -193,3 +193,4 @@ Released with 1.0.0-beta.37 code base.

- Fix intermittent CI build issues with `dtslint`. (#3479)
- Fix provider "error" / "end" events not fired when Websocket provider disconnects (#3485)
- Fix WSS credentials Base64 encoding (for browser) (#3508)
2 changes: 1 addition & 1 deletion packages/web3-providers-ws/src/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ if (isNode) {
helpers = require('url').parse;
}
} else {
_btoa = btoa;
_btoa = btoa.bind(window);
helpers = function(url) {
return new URL(url);
};
Expand Down
7 changes: 6 additions & 1 deletion test/e2e.contract.deploy.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,9 +151,10 @@ describe('contract.deploy [ @E2E ]', function() {
describe('ws', function() {
// Websockets extremely erratic for geth instamine...
if (process.env.GETH_INSTAMINE) return;
var port;

before(async function(){
var port = utils.getWebsocketPort();
port = utils.getWebsocketPort();

web3 = new Web3('ws://localhost:' + port);
accounts = await web3.eth.getAccounts();
Expand Down Expand Up @@ -259,6 +260,10 @@ describe('contract.deploy [ @E2E ]', function() {
done();
})
})

it('can connect over wss with username:password header', function(){
const _web3 = new Web3('wss://usr:psswrd@localhost:' + port);
});
});
});

0 comments on commit d543605

Please sign in to comment.