-
Notifications
You must be signed in to change notification settings - Fork 92
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add requestHandler ctor pass through type (#1089)
* feat: add requestHandler ctor pass through type * move handler init types to @smithy/types * formatting
- Loading branch information
Showing
6 changed files
with
121 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
"@smithy/fetch-http-handler": minor | ||
"@smithy/node-http-handler": minor | ||
"@smithy/types": minor | ||
--- | ||
|
||
move default fetch and http handler ctor types to the types package |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
import type { Agent as hAgent } from "http"; | ||
import type { Agent as hsAgent } from "https"; | ||
|
||
/** | ||
* | ||
* This type represents an alternate client constructor option for the entry | ||
* "requestHandler". Instead of providing an instance of a requestHandler, the user | ||
* may provide the requestHandler's constructor options for either the | ||
* NodeHttpHandler or FetchHttpHandler. | ||
* | ||
* For other RequestHandlers like HTTP2 or WebSocket, | ||
* constructor parameter passthrough is not currently available. | ||
* | ||
* @public | ||
*/ | ||
export type RequestHandlerParams = NodeHttpHandlerOptions | FetchHttpHandlerOptions; | ||
|
||
/** | ||
* Represents the http options that can be passed to a node http client. | ||
* @public | ||
*/ | ||
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; | ||
} | ||
|
||
/** | ||
* Represents the http options that can be passed to a browser http client. | ||
* @public | ||
*/ | ||
export interface FetchHttpHandlerOptions { | ||
/** | ||
* The number of milliseconds a request can take before being automatically | ||
* terminated. | ||
*/ | ||
requestTimeout?: number; | ||
|
||
/** | ||
* Whether to allow the request to outlive the page. Default value is false. | ||
* | ||
* There may be limitations to the payload size, number of concurrent requests, | ||
* request duration etc. when using keepalive in browsers. | ||
* | ||
* These may change over time, so look for up to date information about | ||
* these limitations before enabling keepalive. | ||
*/ | ||
keepAlive?: boolean; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters