Skip to content

Commit

Permalink
feat: requestHandler ctor param pass-through
Browse files Browse the repository at this point in the history
  • Loading branch information
kuhe committed Feb 21, 2024
1 parent b163378 commit f17c7a1
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 12 deletions.
8 changes: 4 additions & 4 deletions clients/client-s3/src/S3Client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ import {
import { getContentLengthPlugin } from "@smithy/middleware-content-length";
import { EndpointInputConfig, EndpointResolvedConfig, resolveEndpointConfig } from "@smithy/middleware-endpoint";
import { getRetryPlugin, resolveRetryConfig, RetryInputConfig, RetryResolvedConfig } from "@smithy/middleware-retry";
import { HttpHandler as __HttpHandler } from "@smithy/protocol-http";
import { HttpHandlerUserInput as __HttpHandlerUserInput } from "@smithy/protocol-http";
import {
Client as __Client,
DefaultsMode as __DefaultsMode,
Expand Down Expand Up @@ -540,11 +540,11 @@ export type ServiceOutputTypes =
/**
* @public
*/
export interface ClientDefaults extends Partial<__SmithyResolvedConfiguration<__HttpHandlerOptions>> {
export interface ClientDefaults extends Partial<__SmithyConfiguration<__HttpHandlerOptions>> {
/**
* The HTTP handler to use. Fetch in browser and Https in Nodejs.
* The HTTP handler to use or its constructor options. Fetch in browser and Https in Nodejs.
*/
requestHandler?: __HttpHandler;
requestHandler?: __HttpHandlerUserInput;

/**
* A constructor for a class implementing the {@link @smithy/types#ChecksumConstructor} interface
Expand Down
1 change: 0 additions & 1 deletion clients/client-s3/src/models/models_0.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// smithy-typescript generated code
import { ExceptionOptionType as __ExceptionOptionType, SENSITIVE_STRING } from "@smithy/smithy-client";

import { StreamingBlobTypes } from "@smithy/types";

import { S3ServiceException as __BaseException } from "./S3ServiceException";
Expand Down
2 changes: 0 additions & 2 deletions clients/client-s3/src/models/models_1.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// smithy-typescript generated code
import { ExceptionOptionType as __ExceptionOptionType, SENSITIVE_STRING } from "@smithy/smithy-client";

import { StreamingBlobTypes } from "@smithy/types";

import {
Expand Down Expand Up @@ -28,7 +27,6 @@ import {
StorageClass,
Tag,
} from "./models_0";

import { S3ServiceException as __BaseException } from "./S3ServiceException";

/**
Expand Down
2 changes: 1 addition & 1 deletion clients/client-s3/src/runtimeConfig.browser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export const getRuntimeConfig = (config: S3ClientConfig) => {
maxAttempts: config?.maxAttempts ?? DEFAULT_MAX_ATTEMPTS,
md5: config?.md5 ?? Md5,
region: config?.region ?? invalidProvider("Region is missing"),
requestHandler: config?.requestHandler ?? new RequestHandler(defaultConfigProvider),
requestHandler: RequestHandler.create(config.requestHandler ?? defaultConfigProvider),
retryMode: config?.retryMode ?? (async () => (await defaultConfigProvider()).retryMode || DEFAULT_RETRY_MODE),
sha1: config?.sha1 ?? Sha1,
sha256: config?.sha256 ?? Sha256,
Expand Down
2 changes: 1 addition & 1 deletion clients/client-s3/src/runtimeConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export const getRuntimeConfig = (config: S3ClientConfig) => {
maxAttempts: config?.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS),
md5: config?.md5 ?? Hash.bind(null, "md5"),
region: config?.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS),
requestHandler: config?.requestHandler ?? new RequestHandler(defaultConfigProvider),
requestHandler: RequestHandler.create(config.requestHandler ?? defaultConfigProvider),
retryMode:
config?.retryMode ??
loadNodeConfig({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public Map<String, Consumer<TypeScriptWriter>> getRuntimeConfigWriters(
writer.addDependency(TypeScriptDependency.AWS_SDK_NODE_HTTP_HANDLER);
writer.addImport("NodeHttp2Handler", "RequestHandler",
TypeScriptDependency.AWS_SDK_NODE_HTTP_HANDLER);
writer.openBlock("new RequestHandler(async () => ({", "}))", () -> {
writer.openBlock("RequestHandler.create(config.requestHandler ?? async () => ({", "}))", () -> {
writer.write("...await defaultConfigProvider(),");
// TODO: remove this when root cause of #3809 is found
writer.write("disableConcurrentStreams: true");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,10 @@ public Map<String, Consumer<TypeScriptWriter>> getRuntimeConfigWriters(
writer.addImport("WebSocketFetchHandler", "WebSocketRequestHandler",
AwsDependency.MIDDLEWARE_WEBSOCKET);
writer.addDependency(AwsDependency.MIDDLEWARE_WEBSOCKET);
writer.write("new WebSocketRequestHandler(defaultConfigProvider, "
+ "new HttpRequestHandler(defaultConfigProvider))");
writer.write(
"WebSocketRequestHandler.create(config.requestHandler ?? defaultConfigProvider, "
+ "HttpRequestHandler.create(defaultConfigProvider))"
);
});
default:
return Collections.emptyMap();
Expand Down

0 comments on commit f17c7a1

Please sign in to comment.