web3-providers-http
Advanced tools
Comparing version 1.0.0-beta.27 to 1.0.0-beta.28
{ | ||
"name": "web3-providers-http", | ||
"namespace": "ethereum", | ||
"version": "1.0.0-beta.27", | ||
"version": "1.0.0-beta.28", | ||
"description": "Module to handle web3 RPC connections over HTTP.", | ||
@@ -10,5 +10,5 @@ "repository": "https://github.com/ethereum/web3.js/tree/master/packages/web3-providers-http", | ||
"dependencies": { | ||
"web3-core-helpers": "1.0.0-beta.27", | ||
"web3-core-helpers": "1.0.0-beta.28", | ||
"xhr2": "0.1.4" | ||
} | ||
} |
@@ -31,9 +31,24 @@ /* | ||
*/ | ||
var HttpProvider = function HttpProvider(host, timeout) { | ||
var HttpProvider = function HttpProvider(host, timeout, headers) { | ||
this.host = host || 'http://localhost:8545'; | ||
this.timeout = timeout || 0; | ||
this.connected = false; | ||
this.headers = headers; | ||
}; | ||
HttpProvider.prototype._prepareRequest = function(){ | ||
var request = new XHR2(); | ||
request.open('POST', this.host, true); | ||
request.setRequestHeader('Content-Type','application/json'); | ||
if(this.headers) { | ||
this.headers.forEach(function(header) { | ||
request.setRequestHeader(header.name, header.value); | ||
}); | ||
} | ||
return request; | ||
}; | ||
/** | ||
@@ -48,6 +63,4 @@ * Should be used to make async request | ||
var _this = this; | ||
var request = new XHR2(); | ||
var request = this._prepareRequest(); | ||
request.open('POST', this.host, true); | ||
request.setRequestHeader('Content-Type','application/json'); | ||
@@ -54,0 +67,0 @@ request.onreadystatechange = function() { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
3851
77
+ Addedweb3-core-helpers@1.0.0-beta.28(transitive)
+ Addedweb3-eth-iban@1.0.0-beta.28(transitive)
+ Addedweb3-utils@1.0.0-beta.28(transitive)
- Removedweb3-core-helpers@1.0.0-beta.27(transitive)
- Removedweb3-eth-iban@1.0.0-beta.27(transitive)
- Removedweb3-utils@1.0.0-beta.27(transitive)