@smithy/node-http-handler
Advanced tools
Comparing version 2.1.10 to 2.2.0
@@ -16,2 +16,8 @@ "use strict"; | ||
class NodeHttpHandler { | ||
static create(instanceOrOptions) { | ||
if (typeof (instanceOrOptions === null || instanceOrOptions === void 0 ? void 0 : instanceOrOptions.handle) === "function") { | ||
return instanceOrOptions; | ||
} | ||
return new NodeHttpHandler(instanceOrOptions); | ||
} | ||
constructor(options) { | ||
@@ -18,0 +24,0 @@ this.metadata = { handlerProtocol: "http/1.1" }; |
@@ -11,2 +11,8 @@ "use strict"; | ||
class NodeHttp2Handler { | ||
static create(instanceOrOptions) { | ||
if (typeof (instanceOrOptions === null || instanceOrOptions === void 0 ? void 0 : instanceOrOptions.handle) === "function") { | ||
return instanceOrOptions; | ||
} | ||
return new NodeHttp2Handler(instanceOrOptions); | ||
} | ||
constructor(options) { | ||
@@ -13,0 +19,0 @@ this.metadata = { handlerProtocol: "h2" }; |
@@ -13,2 +13,8 @@ import { HttpResponse } from "@smithy/protocol-http"; | ||
export class NodeHttpHandler { | ||
static create(instanceOrOptions) { | ||
if (typeof instanceOrOptions?.handle === "function") { | ||
return instanceOrOptions; | ||
} | ||
return new NodeHttpHandler(instanceOrOptions); | ||
} | ||
constructor(options) { | ||
@@ -15,0 +21,0 @@ this.metadata = { handlerProtocol: "http/1.1" }; |
@@ -8,2 +8,8 @@ import { HttpResponse } from "@smithy/protocol-http"; | ||
export class NodeHttp2Handler { | ||
static create(instanceOrOptions) { | ||
if (typeof instanceOrOptions?.handle === "function") { | ||
return instanceOrOptions; | ||
} | ||
return new NodeHttp2Handler(instanceOrOptions); | ||
} | ||
constructor(options) { | ||
@@ -10,0 +16,0 @@ this.metadata = { handlerProtocol: "h2" }; |
@@ -1,33 +0,5 @@ | ||
/// <reference types="node" /> | ||
/// <reference types="node" /> | ||
import { HttpHandler, HttpRequest, HttpResponse } from "@smithy/protocol-http"; | ||
import type { NodeHttpHandlerOptions } from "@smithy/types"; | ||
import { HttpHandlerOptions, Provider } from "@smithy/types"; | ||
import { Agent as hAgent } from "http"; | ||
import { Agent as hsAgent } from "https"; | ||
/** | ||
* Represents the http options that can be passed to a node http client. | ||
*/ | ||
export interface NodeHttpHandlerOptions { | ||
/** | ||
* The maximum time in milliseconds that the connection phase of a request | ||
* may take before the connection attempt is abandoned. | ||
* | ||
* Defaults to 0, which disables the timeout. | ||
*/ | ||
connectionTimeout?: number; | ||
/** | ||
* The number of milliseconds a request can take before automatically being terminated. | ||
* Defaults to 0, which disables the timeout. | ||
*/ | ||
requestTimeout?: number; | ||
/** | ||
* @deprecated Use {@link requestTimeout} | ||
* | ||
* The maximum time in milliseconds that a socket may remain idle before it | ||
* is closed. | ||
*/ | ||
socketTimeout?: number; | ||
httpAgent?: hAgent; | ||
httpsAgent?: hsAgent; | ||
} | ||
export { NodeHttpHandlerOptions }; | ||
export declare const DEFAULT_REQUEST_TIMEOUT = 0; | ||
@@ -40,2 +12,7 @@ export declare class NodeHttpHandler implements HttpHandler<NodeHttpHandlerOptions> { | ||
}; | ||
/** | ||
* @returns the input if it is an HttpHandler of any class, | ||
* or instantiates a new instance of this handler. | ||
*/ | ||
static create(instanceOrOptions?: HttpHandler<any> | NodeHttpHandlerOptions): NodeHttpHandler | HttpHandler<any>; | ||
constructor(options?: NodeHttpHandlerOptions | Provider<NodeHttpHandlerOptions | void>); | ||
@@ -42,0 +19,0 @@ private resolveDefaultConfig; |
@@ -40,2 +40,7 @@ import { HttpHandler, HttpRequest, HttpResponse } from "@smithy/protocol-http"; | ||
private readonly connectionManager; | ||
/** | ||
* @returns the input if it is an HttpHandler of any class, | ||
* or instantiates a new instance of this handler. | ||
*/ | ||
static create(instanceOrOptions?: HttpHandler<any> | NodeHttp2HandlerOptions): HttpHandler<any> | NodeHttp2Handler; | ||
constructor(options?: NodeHttp2HandlerOptions | Provider<NodeHttp2HandlerOptions | void>); | ||
@@ -42,0 +47,0 @@ destroy(): void; |
@@ -1,32 +0,5 @@ | ||
/// <reference types="node" /> | ||
import { HttpHandler, HttpRequest, HttpResponse } from "@smithy/protocol-http"; | ||
import { NodeHttpHandlerOptions } from "@smithy/types"; | ||
import { HttpHandlerOptions, Provider } from "@smithy/types"; | ||
import { Agent as hAgent } from "http"; | ||
import { Agent as hsAgent } from "https"; | ||
/** | ||
* Represents the http options that can be passed to a node http client. | ||
*/ | ||
export interface NodeHttpHandlerOptions { | ||
/** | ||
* The maximum time in milliseconds that the connection phase of a request | ||
* may take before the connection attempt is abandoned. | ||
* | ||
* Defaults to 0, which disables the timeout. | ||
*/ | ||
connectionTimeout?: number; | ||
/** | ||
* The number of milliseconds a request can take before automatically being terminated. | ||
* Defaults to 0, which disables the timeout. | ||
*/ | ||
requestTimeout?: number; | ||
/** | ||
* @deprecated Use {@link requestTimeout} | ||
* | ||
* The maximum time in milliseconds that a socket may remain idle before it | ||
* is closed. | ||
*/ | ||
socketTimeout?: number; | ||
httpAgent?: hAgent; | ||
httpsAgent?: hsAgent; | ||
} | ||
export { NodeHttpHandlerOptions }; | ||
export declare const DEFAULT_REQUEST_TIMEOUT = 0; | ||
@@ -39,2 +12,7 @@ export declare class NodeHttpHandler implements HttpHandler<NodeHttpHandlerOptions> { | ||
}; | ||
/** | ||
* @returns the input if it is an HttpHandler of any class, | ||
* or instantiates a new instance of this handler. | ||
*/ | ||
static create(instanceOrOptions?: HttpHandler<any> | NodeHttpHandlerOptions): NodeHttpHandler | HttpHandler<any>; | ||
constructor(options?: NodeHttpHandlerOptions | Provider<NodeHttpHandlerOptions | void>); | ||
@@ -41,0 +19,0 @@ private resolveDefaultConfig; |
@@ -40,2 +40,7 @@ import { HttpHandler, HttpRequest, HttpResponse } from "@smithy/protocol-http"; | ||
private readonly connectionManager; | ||
/** | ||
* @returns the input if it is an HttpHandler of any class, | ||
* or instantiates a new instance of this handler. | ||
*/ | ||
static create(instanceOrOptions?: HttpHandler<any> | NodeHttp2HandlerOptions): HttpHandler<any> | NodeHttp2Handler; | ||
constructor(options?: NodeHttp2HandlerOptions | Provider<NodeHttp2HandlerOptions | void>); | ||
@@ -42,0 +47,0 @@ destroy(): void; |
{ | ||
"name": "@smithy/node-http-handler", | ||
"version": "2.1.10", | ||
"version": "2.2.0", | ||
"description": "Provides a way to make requests", | ||
@@ -12,3 +12,3 @@ "scripts": { | ||
"stage-release": "rimraf ./.release && yarn pack && mkdir ./.release && tar zxvf ./package.tgz --directory ./.release && rm ./package.tgz", | ||
"clean": "rimraf ./dist-* && rimraf *.tsbuildinfo", | ||
"clean": "rimraf ./dist-* && rimraf *.tsbuildinfo || exit 0", | ||
"lint": "eslint -c ../../.eslintrc.js \"src/**/*.ts\"", | ||
@@ -29,6 +29,6 @@ "format": "prettier --config ../../prettier.config.js --ignore-path ../.prettierignore --write \"**/*.{ts,md,json}\"", | ||
"dependencies": { | ||
"@smithy/abort-controller": "^2.0.14", | ||
"@smithy/protocol-http": "^3.0.10", | ||
"@smithy/querystring-builder": "^2.0.14", | ||
"@smithy/types": "^2.6.0", | ||
"@smithy/abort-controller": "^2.0.15", | ||
"@smithy/protocol-http": "^3.0.11", | ||
"@smithy/querystring-builder": "^2.0.15", | ||
"@smithy/types": "^2.7.0", | ||
"tslib": "^2.5.0" | ||
@@ -35,0 +35,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
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
83295
1718