web3-providers-http
Advanced tools
Comparing version 1.0.0-beta.34 to 1.0.0-beta.35
{ | ||
"name": "web3-providers-http", | ||
"namespace": "ethereum", | ||
"version": "1.0.0-beta.34", | ||
"version": "1.0.0-beta.35", | ||
"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.34", | ||
"xhr2": "0.1.4" | ||
"web3-core-helpers": "1.0.0-beta.35", | ||
"xhr2-cookies": "1.1.0" | ||
} | ||
} |
@@ -34,3 +34,7 @@ # web3-providers-http | ||
var http = new Web3HttpProvider('http://localhost:8545'); | ||
var options = { | ||
timeout: 20000, // milliseconds, | ||
headers: [{name: 'Access-Control-Allow-Origin', value: '*'},{...}] | ||
}; | ||
var http = new Web3HttpProvider('http://localhost:8545', options); | ||
``` | ||
@@ -37,0 +41,0 @@ |
@@ -26,3 +26,3 @@ /* | ||
var errors = require('web3-core-helpers').errors; | ||
var XHR2 = require('xhr2'); // jshint ignore: line | ||
var XHR2 = require('xhr2-cookies').XMLHttpRequest // jshint ignore: line | ||
@@ -32,7 +32,8 @@ /** | ||
*/ | ||
var HttpProvider = function HttpProvider(host, timeout, headers) { | ||
var HttpProvider = function HttpProvider(host, options) { | ||
options = options || {}; | ||
this.host = host || 'http://localhost:8545'; | ||
this.timeout = timeout || 0; | ||
this.timeout = options.timeout || 0; | ||
this.headers = options.headers; | ||
this.connected = false; | ||
this.headers = headers; | ||
}; | ||
@@ -45,2 +46,4 @@ | ||
request.setRequestHeader('Content-Type','application/json'); | ||
request.timeout = this.timeout && this.timeout !== 1 ? this.timeout : 0; | ||
request.withCredentials = true; | ||
@@ -67,3 +70,2 @@ if(this.headers) { | ||
request.onreadystatechange = function() { | ||
@@ -70,0 +72,0 @@ if (request.readyState === 4 && request.timeout !== 1) { |
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
4165
46
3
80
+ Addedxhr2-cookies@1.1.0
+ Addedcookiejar@2.1.4(transitive)
+ Addedweb3-core-helpers@1.0.0-beta.35(transitive)
+ Addedweb3-eth-iban@1.0.0-beta.35(transitive)
+ Addedweb3-utils@1.0.0-beta.35(transitive)
+ Addedxhr2-cookies@1.1.0(transitive)
- Removedxhr2@0.1.4
- Removedweb3-core-helpers@1.0.0-beta.34(transitive)
- Removedweb3-eth-iban@1.0.0-beta.34(transitive)
- Removedweb3-utils@1.0.0-beta.34(transitive)
- Removedxhr2@0.1.4(transitive)