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

Commit 8361f40

Browse files
committed
runtime check inverted
1 parent 54cbafe commit 8361f40

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

dist/web3.min.js

-1
This file was deleted.

packages/web3-providers-http/src/index.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -51,15 +51,15 @@ var HttpProvider = function HttpProvider(host, options) {
5151
HttpProvider.prototype._prepareRequest = function(){
5252
var request;
5353

54-
// runtime is of type node
55-
if (typeof process !== 'undefined' && process.versions !== null && process.versions.node !== null) {
54+
// the current runtime is a browser
55+
if (typeof XMLHttpRequest !== 'undefined') {
56+
request = new XMLHttpRequest();
57+
} else {
5658
request = new XHR2();
5759
request.nodejsSet({
5860
httpsAgent:this.httpsAgent,
5961
httpAgent:this.httpAgent
6062
});
61-
} else {
62-
request = new XMLHttpRequest();
6363
}
6464

6565
request.open('POST', this.host, true);

0 commit comments

Comments
 (0)