web3-providers-http
Advanced tools
Comparing version 1.2.4 to 1.2.5-rc.0
{ | ||
"name": "web3-providers-http", | ||
"version": "1.2.4", | ||
"version": "1.2.5-rc.0", | ||
"description": "Module to handle web3 RPC connections over HTTP.", | ||
@@ -16,3 +16,3 @@ "repository": "https://github.com/ethereum/web3.js/tree/1.x/packages/web3-providers-http", | ||
"dependencies": { | ||
"web3-core-helpers": "1.2.4", | ||
"web3-core-helpers": "1.2.5-rc.0", | ||
"xhr2-cookies": "1.1.0" | ||
@@ -24,3 +24,3 @@ }, | ||
}, | ||
"gitHead": "341015ab24efc3ea1e5d8afd07e8c92a7c738536" | ||
"gitHead": "e919f81ccf7fee23a2d9075fa141bec0ff4a087a" | ||
} |
@@ -31,9 +31,14 @@ # web3-providers-http | ||
// in node.js | ||
var http = require('http'); | ||
var Web3HttpProvider = require('web3-providers-http'); | ||
var options = { | ||
keepAlive: true, | ||
timeout: 20000, // milliseconds, | ||
headers: [{name: 'Access-Control-Allow-Origin', value: '*'},{...}] | ||
headers: [{name: 'Access-Control-Allow-Origin', value: '*'},{...}], | ||
withCredentials: false, | ||
agent: {http: http.Agent(...), baseUrl: ''} | ||
}; | ||
var http = new Web3HttpProvider('http://localhost:8545', options); | ||
var provider = new Web3HttpProvider('http://localhost:8545', options); | ||
``` | ||
@@ -40,0 +45,0 @@ |
@@ -37,14 +37,17 @@ /* | ||
var keepAlive = (options.keepAlive === true || options.keepAlive !== false) ? true : false; | ||
this.host = host || 'http://localhost:8545'; | ||
if (this.host.substring(0,5) === "https") { | ||
this.httpsAgent = new https.Agent({ keepAlive: keepAlive }); | ||
} else { | ||
this.httpAgent = new http.Agent({ keepAlive: keepAlive }); | ||
} | ||
this.withCredentials = options.withCredentials || false; | ||
this.timeout = options.timeout || 0; | ||
this.headers = options.headers; | ||
this.agent = options.agent; | ||
this.connected = false; | ||
var keepAlive = (options.keepAlive === true || options.keepAlive !== false) ? true : false; | ||
this.host = host || 'http://localhost:8545'; | ||
if (!this.agent) { | ||
if (this.host.substring(0,5) === "https") { | ||
this.httpsAgent = new https.Agent({ keepAlive: keepAlive }); | ||
} else { | ||
this.httpAgent = new http.Agent({ keepAlive: keepAlive }); | ||
} | ||
} | ||
}; | ||
@@ -60,6 +63,11 @@ | ||
request = new XHR2(); | ||
request.nodejsSet({ | ||
httpsAgent:this.httpsAgent, | ||
httpAgent:this.httpAgent | ||
}); | ||
var agents = {httpsAgent: this.httpsAgent, httpAgent: this.httpAgent, baseUrl: this.baseUrl}; | ||
if (this.agent) { | ||
agents.httpsAgent = this.agent.https; | ||
agents.httpAgent = this.agent.http; | ||
agents.baseUrl = this.agent.baseUrl; | ||
} | ||
request.nodejsSet(agents); | ||
} | ||
@@ -66,0 +74,0 @@ |
@@ -23,2 +23,4 @@ /* | ||
import * as http from 'http'; | ||
import * as https from 'https'; | ||
import { HttpProvider } from 'web3-providers'; | ||
@@ -35,3 +37,8 @@ import { JsonRpcResponse } from 'web3-core-helpers'; | ||
], | ||
withCredentials: false | ||
withCredentials: false, | ||
agent: { | ||
baseUrl: 'base', | ||
http: new http.Agent({}), | ||
https: new https.Agent({}) | ||
} | ||
}); | ||
@@ -38,0 +45,0 @@ |
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
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
9693
207
51
2
+ Addedweb3-core-helpers@1.2.5-rc.0(transitive)
+ Addedweb3-eth-iban@1.2.5-rc.0(transitive)
+ Addedweb3-utils@1.2.5-rc.0(transitive)
- Removedweb3-core-helpers@1.2.4(transitive)
- Removedweb3-eth-iban@1.2.4(transitive)
- Removedweb3-utils@1.2.4(transitive)
Updatedweb3-core-helpers@1.2.5-rc.0