Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

lcm-requester

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lcm-requester - npm Package Compare versions

Comparing version 2.2.1 to 3.0.0

src/Requester.js

13

CHANGELOG.md
# 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)]
'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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc