Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: allow http(s).Agent ctor arg in lieu of instance #1165

Merged
merged 2 commits into from
Feb 21, 2024

Conversation

kuhe
Copy link
Contributor

@kuhe kuhe commented Feb 20, 2024

Simplify usage by allowing http(s).Agent constructor argument instead of an instance of such.

Before:

import https from "node:https";
import { DynamoDBClient } from "@aws-sdk/client-dynamodb";
import { NodeHttpHandler } from "@smithy/node-http-handler";

const client = new DynamoDBClient({
  requestHandler: new NodeHttpHandler({
    requestTimeout: 3_000,
    httpsAgent: new https.Agent({
      maxSockets: 25
    }),
  }),
});

After:

import { DynamoDBClient } from "@aws-sdk/client-dynamodb";
import { NodeHttpHandler } from "@smithy/node-http-handler";

const client = new DynamoDBClient({
  requestHandler: new NodeHttpHandler({
    requestTimeout: 3_000,
    httpsAgent: { maxSockets: 25 },
  }),
});

End goal:

import { DynamoDBClient } from "@aws-sdk/client-dynamodb";

const client = new DynamoDBClient({
  requestHandler: {
    requestTimeout: 3_000,
    httpsAgent: { maxSockets: 25 },
  },
});

// the longer forms will still be valid

@kuhe kuhe requested review from a team as code owners February 20, 2024 17:07
@kuhe kuhe merged commit d70a00a into smithy-lang:main Feb 21, 2024
7 checks passed
@kuhe kuhe deleted the feat/agents branch February 21, 2024 18:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants