@dazn/lambda-powertools-http-client
Advanced tools
Comparing version 1.16.1 to 1.17.0
@@ -6,2 +6,13 @@ # Change Log | ||
# [1.17.0](https://github.com/getndazn/dazn-lambda-powertools/compare/v1.16.1...v1.17.0) (2020-01-02) | ||
### Features | ||
* **http-client:** add support for patch and url option ([6e70261](https://github.com/getndazn/dazn-lambda-powertools/commit/6e70261)) | ||
## [1.16.1](https://github.com/getndazn/dazn-lambda-powertools/compare/v1.16.0...v1.16.1) (2020-01-02) | ||
@@ -8,0 +19,0 @@ |
15
index.js
@@ -29,2 +29,4 @@ const CorrelationIds = require('@dazn/lambda-powertools-correlation-ids') | ||
return HTTP.del(uri) | ||
case 'patch': | ||
return HTTP.patch(uri) | ||
default: | ||
@@ -64,4 +66,4 @@ throw new Error(`unsupported method : ${method.toLowerCase()}`) | ||
// options: { | ||
// uri : string | ||
// method : GET (default) | POST | PUT | HEAD | ||
// uri/url : string (either uri or url must be specified) | ||
// method : GET (default) | POST | PUT | HEAD | DELETE | PATCH | ||
// headers : object | ||
@@ -80,4 +82,5 @@ // qs : object | ||
if (!options.uri) { | ||
throw new Error('no HTTP uri is specified') | ||
const uri = options.uri || options.url | ||
if (!uri) { | ||
throw new Error('no HTTP uri or url is specified') | ||
} | ||
@@ -91,3 +94,3 @@ | ||
const method = options.method || 'get' | ||
let request = getRequest(options.uri, method) | ||
let request = getRequest(uri, method) | ||
@@ -103,3 +106,3 @@ request = setHeaders(request, headers) | ||
const start = Date.now() | ||
const url = new URL.URL(options.uri) | ||
const url = new URL.URL(uri) | ||
const metricName = options.metricName || url.hostname + '.response' | ||
@@ -106,0 +109,0 @@ const requestMetricTags = [ |
{ | ||
"name": "@dazn/lambda-powertools-http-client", | ||
"version": "1.16.1", | ||
"version": "1.17.0", | ||
"description": "HTTP client that supports forwarding correlation IDs (captured via @dazn/lambda-powertools-correlation-ids) and auto-records metrics", | ||
@@ -23,3 +23,3 @@ "main": "index.js", | ||
}, | ||
"gitHead": "d5878da408ee060b4bfef3326105dae6db00e79e" | ||
"gitHead": "cee461519ff6ca3cfd8498943602866d3a56cc85" | ||
} |
@@ -51,4 +51,4 @@ # lambda-powertools-http-client | ||
{ | ||
uri : string | ||
method : GET (default) | POST | PUT | HEAD | ||
uri/url : string (either uri or url must be specified) | ||
method : GET (default) | POST | PUT | HEAD | DELETE | PATCH | ||
headers : object | ||
@@ -55,0 +55,0 @@ qs : object |
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
23687
10
452
4