Skip to content

Commit cdf7a15

Browse files
committed
align static create and ctor signatures for http handlers
1 parent 44f78bd commit cdf7a15

File tree

4 files changed

+12
-4
lines changed

4 files changed

+12
-4
lines changed

.changeset/serious-otters-breathe.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"@smithy/fetch-http-handler": patch
3+
"@smithy/node-http-handler": patch
4+
---
5+
6+
align ctor and static creation signatures for http handlers

packages/fetch-http-handler/src/fetch-http-handler.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export class FetchHttpHandler implements HttpHandler<FetchHttpHandlerConfig> {
3232
* @returns the input if it is an HttpHandler of any class,
3333
* or instantiates a new instance of this handler.
3434
*/
35-
public static create(instanceOrOptions?: HttpHandler<any> | FetchHttpHandlerConfig) {
35+
public static create(instanceOrOptions?: HttpHandler<any> | FetchHttpHandlerOptions | Provider<FetchHttpHandlerOptions | void>) {
3636
if (typeof (instanceOrOptions as any)?.handle === "function") {
3737
// is already an instance of HttpHandler.
3838
return instanceOrOptions as HttpHandler<any>;
@@ -41,7 +41,7 @@ export class FetchHttpHandler implements HttpHandler<FetchHttpHandlerConfig> {
4141
return new FetchHttpHandler(instanceOrOptions as FetchHttpHandlerConfig);
4242
}
4343

44-
constructor(options?: FetchHttpHandlerOptions | Provider<FetchHttpHandlerOptions | undefined>) {
44+
constructor(options?: FetchHttpHandlerOptions | Provider<FetchHttpHandlerOptions | void>) {
4545
if (typeof options === "function") {
4646
this.configProvider = options().then((opts) => opts || {});
4747
} else {

packages/node-http-handler/src/node-http-handler.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export class NodeHttpHandler implements HttpHandler<NodeHttpHandlerOptions> {
3434
* @returns the input if it is an HttpHandler of any class,
3535
* or instantiates a new instance of this handler.
3636
*/
37-
public static create(instanceOrOptions?: HttpHandler<any> | NodeHttpHandlerOptions) {
37+
public static create(instanceOrOptions?: HttpHandler<any> | NodeHttpHandlerOptions | Provider<NodeHttpHandlerOptions | void>) {
3838
if (typeof (instanceOrOptions as any)?.handle === "function") {
3939
// is already an instance of HttpHandler.
4040
return instanceOrOptions as HttpHandler<any>;

packages/node-http-handler/src/node-http2-handler.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,9 @@ export class NodeHttp2Handler implements HttpHandler<NodeHttp2HandlerOptions> {
5353
* @returns the input if it is an HttpHandler of any class,
5454
* or instantiates a new instance of this handler.
5555
*/
56-
public static create(instanceOrOptions?: HttpHandler<any> | NodeHttp2HandlerOptions) {
56+
public static create(
57+
instanceOrOptions?: HttpHandler<any> | NodeHttp2HandlerOptions | Provider<NodeHttp2HandlerOptions | void>
58+
) {
5759
if (typeof (instanceOrOptions as any)?.handle === "function") {
5860
// is already an instance of HttpHandler.
5961
return instanceOrOptions as HttpHandler<any>;

0 commit comments

Comments
 (0)