@everymundo/promise-data-to
Advanced tools
Comparing version 1.4.1 to 1.4.2
@@ -12,4 +12,4 @@ 'use strict' | ||
const MAX_RETRY_ATTEMPTS = Math.abs(process.env.MAX_RETRY_ATTEMPTS) || 3 | ||
const RETRY_TIMEOUT_MS = Math.abs(process.env.RETRY_TIMEOUT_MS) || 500 | ||
const REQUEST_TIMEOUT_MS = Math.abs(process.env.RETRY_TIMEOUT_MS) || 10000 | ||
const RETRY_TIMEOUT_MS = process.env.RETRY_TIMEOUT_MS && Math.abs(process.env.RETRY_TIMEOUT_MS) | ||
const REQUEST_TIMEOUT_MS = process.env.REQUEST_TIMEOUT_MS && Math.abs(process.env.REQUEST_TIMEOUT_MS) | ||
@@ -44,4 +44,3 @@ const promiseDataTo = ({ | ||
headers, | ||
agent, | ||
timeout | ||
agent | ||
} | ||
@@ -132,2 +131,12 @@ | ||
if (['PUT', 'PATCH', 'POST'].includes(method.toUpperCase())) request.write(data) | ||
if (timeout != null) { | ||
request.on('socket', (socket) => { | ||
socket.on('timeout', () => { | ||
request.abort() | ||
}) | ||
socket.setTimeout(timeout) | ||
}) | ||
} | ||
request.end() | ||
@@ -134,0 +143,0 @@ } |
{ | ||
"name": "@everymundo/promise-data-to", | ||
"version": "1.4.1", | ||
"version": "1.4.2", | ||
"description": "This is a helper to perform POST requests using promises and no external dependencies", | ||
@@ -10,7 +10,7 @@ "main": "index.js", | ||
"scripts": { | ||
"cover": "env RETRY_TIMEOUT_MS= MAX_RETRY_ATTEMPTS= SIMULATE= LOG_LEVEL=trace nyc -x test --reporter=lcov --reporter=text mocha test --recursive", | ||
"cover": "env RETRY_TIMEOUT_MS= MAX_RETRY_ATTEMPTS= REQUEST_TIMEOUT_MS= SIMULATE= LOG_LEVEL=trace nyc -x test --reporter=lcov --reporter=text mocha test --recursive", | ||
"check-coverage": "nyc check-coverage --statements 100 --branches 100 --functions 100 --lines 100", | ||
"check-lint": "standard --env=mocha *.js lib/*.js test/*.js test/lib/*.js", | ||
"fix-lint": "standard --env=mocha --fix *.js lib/*.js test/*.js", | ||
"test": "env RETRY_TIMEOUT_MS= MAX_RETRY_ATTEMPTS= SIMULATE= mocha" | ||
"test": "env RETRY_TIMEOUT_MS= MAX_RETRY_ATTEMPTS= REQUEST_TIMEOUT_MS= SIMULATE= mocha" | ||
}, | ||
@@ -17,0 +17,0 @@ "config": { |
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
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
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
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
15403
400
6
11