Skip to content

Commit

Permalink
Fix default HttpHandlerConfig type for HttpHandler
Browse files Browse the repository at this point in the history
  • Loading branch information
AndrewFossAWS committed Sep 7, 2023
1 parent ead0614 commit afbbfcb
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
5 changes: 5 additions & 0 deletions .changeset/afraid-spies-smash.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@smithy/protocol-http": patch
---

Fix default HttpHandlerConfig type for HttpHandler
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { HttpHandler } from "../httpHandler";
/**
* @internal
*/
export interface HttpHandlerExtensionConfiguration<HandlerConfig extends object = Record<string, unknown>> {
export interface HttpHandlerExtensionConfiguration<HandlerConfig extends object = {}> {
setHttpHandler(handler: HttpHandler<HandlerConfig>): void;
httpHandler(): HttpHandler<HandlerConfig>;
updateHttpClientConfig(key: keyof HandlerConfig, value: HandlerConfig[typeof key]): void;
Expand All @@ -13,7 +13,7 @@ export interface HttpHandlerExtensionConfiguration<HandlerConfig extends object
/**
* @internal
*/
export type HttpHandlerExtensionConfigType<HandlerConfig extends object = Record<string, unknown>> = Partial<{
export type HttpHandlerExtensionConfigType<HandlerConfig extends object = {}> = Partial<{
httpHandler: HttpHandler<HandlerConfig>;
}>;

Expand All @@ -22,7 +22,7 @@ export type HttpHandlerExtensionConfigType<HandlerConfig extends object = Record
*
* Helper function to resolve default extension configuration from runtime config
*/
export const getHttpHandlerExtensionConfiguration = <HandlerConfig extends object = Record<string, unknown>>(
export const getHttpHandlerExtensionConfiguration = <HandlerConfig extends object = {}>(
runtimeConfig: HttpHandlerExtensionConfigType<HandlerConfig>
) => {
let httpHandler = runtimeConfig.httpHandler!;
Expand All @@ -47,7 +47,7 @@ export const getHttpHandlerExtensionConfiguration = <HandlerConfig extends objec
*
* Helper function to resolve runtime config from default extension configuration
*/
export const resolveHttpHandlerRuntimeConfig = <HandlerConfig extends object = Record<string, unknown>>(
export const resolveHttpHandlerRuntimeConfig = <HandlerConfig extends object = {}>(
httpHandlerExtensionConfiguration: HttpHandlerExtensionConfiguration<HandlerConfig>
): HttpHandlerExtensionConfigType<HandlerConfig> => {
return {
Expand Down
2 changes: 1 addition & 1 deletion packages/protocol-http/src/httpHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { HttpResponse } from "./httpResponse";
/**
* @internal
*/
export type HttpHandler<HttpHandlerConfig extends object = Record<string, unknown>> = RequestHandler<
export type HttpHandler<HttpHandlerConfig extends object = {}> = RequestHandler<
HttpRequest,
HttpResponse,
HttpHandlerOptions
Expand Down

0 comments on commit afbbfcb

Please sign in to comment.