lcm-requester
Advanced tools
Comparing version 2.2.1 to 3.0.0
# Changelog | ||
### 2.2.1 | ||
### 3.0.0 | ||
IMPROVEMENTS: | ||
- Dependencies was bumped [[GH-2](https://github.com/LCMApps/lcm-requester/pull/2), | ||
[GH-4](https://github.com/LCMApps/dns-lookup-cache/pull/4), [GH-7](https://github.com/LCMApps/lcm-requester/pull/7), | ||
[GH-8](https://github.com/LCMApps/lcm-requester/pull/8), [GH-9](https://github.com/LCMApps/lcm-requester/pull/9)] | ||
- requester was rewrote in OOP style | ||
[[GH-13](https://github.com/LCMApps/lcm-requester/pull/13)] | ||
- Dependencies was bumped | ||
BUG FIXES: | ||
- Fix of memory leak with keep alive connections | ||
[[GH-15](https://github.com/LCMApps/lcm-requester/issues/15)] |
14
index.js
'use strict'; | ||
const GlobalSettings = require('./src/GlobalSettings'); | ||
const Requester = require('./src/Requester'); | ||
const ResponseAssert = require('./src/ResponseAssert'); | ||
const errors = require('./src/Error'); | ||
const globalSettings = new GlobalSettings(); | ||
const supportedMethods = require('./src/SupportedMethods')(globalSettings); | ||
module.exports = { | ||
getTimeout: globalSettings.getTimeout.bind(globalSettings), | ||
setTimeout: globalSettings.setTimeout.bind(globalSettings), | ||
getTiming: globalSettings.getTiming.bind(globalSettings), | ||
setTiming: globalSettings.setTiming.bind(globalSettings), | ||
getRequest: supportedMethods.getRequest, | ||
postFormUrlencodedRequest: supportedMethods.postFormUrlencodedRequest, | ||
postJsonRequest: supportedMethods.postJsonRequest, | ||
deleteRequest: supportedMethods.deleteRequest, | ||
Requester, | ||
assertResponse: ResponseAssert.assertResponse, | ||
errors: errors | ||
}; |
{ | ||
"name": "lcm-requester", | ||
"version": "2.2.1", | ||
"version": "3.0.0", | ||
"description": "lcm-requster is a wrapper on request module with validation on top of format and rules used", | ||
@@ -41,5 +41,5 @@ "scripts": { | ||
"mocha": "5.2.0", | ||
"nock": "10.0.1", | ||
"nock": "10.0.2", | ||
"proxyquire": "2.1.0", | ||
"sinon": "7.1.0" | ||
"sinon": "7.1.1" | ||
}, | ||
@@ -46,0 +46,0 @@ "bugs": { |
@@ -19,8 +19,54 @@ # lcm-requester - is a wrapper on request module with validation on top of format and rules used | ||
#Configuration | ||
All available transports and configuration options listed below: | ||
Parameter "agentOptions" support the same options like [HTTP Agent](https://nodejs.org/api/http.html#http_new_agent_options) | ||
or [HTTPS Agent](https://nodejs.org/api/https.html#http_new_agent_options) | ||
Example: | ||
```json | ||
{ | ||
"requester": { | ||
"timeoutMsecs": 1000, | ||
"timing": true, | ||
"agentOptions": { | ||
"keepAlive": true, | ||
"keepAliveMsecs": 500, | ||
"maxSockets": 10000, | ||
"maxFreeSockets": 200, | ||
"timeout": 2000 | ||
} | ||
} | ||
} | ||
``` | ||
# Super simple to use | ||
```js | ||
const requester = require('lcm-requester'); | ||
const {Requester} = require('lcm-requester'); | ||
``` | ||
```js | ||
// Use default configuration | ||
const requester = new Requester(); | ||
``` | ||
```js | ||
// Use custom timeout on request with timing info | ||
const requester = new Requester({ | ||
timeoutMsecs: 2000, | ||
timing: true | ||
}); | ||
``` | ||
```js | ||
// Use custom HTTP Agent for requests | ||
const requester = new Requester({ | ||
timeoutMsecs: 2000, | ||
agentOptions: { | ||
keepAlive: true | ||
} | ||
}); | ||
``` | ||
const response = await requester.getRequest('https://google.com/path?arg1=val1'); | ||
```js | ||
const {response, responseBody} = await requester.getRequest('https://google.com/path?arg1=val1'); | ||
const {response, responseBody} = await requester.postFormUrlencodedRequest('https://google.com/path?arg1=val1'); | ||
const {response, responseBody} = await requester.postJsonRequest('https://google.com/path?arg1=val1', {}); | ||
const {response, responseBody} = await requester.deleteRequest('https://google.com/path?arg1=val1'); | ||
``` |
Sorry, the diff of this file is not supported yet
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
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
171349
2635
72
14