Skip to content

refactor: reuse shared setHttpAgent in DynamoDB module#89

Draft
rafaelmatsumotomb wants to merge 2 commits intomainfrom
refactor/reuse-set-http-agent
Draft

refactor: reuse shared setHttpAgent in DynamoDB module#89
rafaelmatsumotomb wants to merge 2 commits intomainfrom
refactor/reuse-set-http-agent

Conversation

@rafaelmatsumotomb
Copy link
Contributor

@rafaelmatsumotomb rafaelmatsumotomb commented Mar 11, 2026

Summary

  • Remove duplicated setupHTTPAgent from lib/dynamo/index.js and delegate to the shared setHttpAgent utility in lib/utils.js
  • Update setHttpAgent to handle both string endpoints ('http://localhost:8000') and AWS.Endpoint objects ({ protocol: 'http:' })
  • Add test coverage for string endpoint handling, bringing branch coverage to 100%

Closes #88

🤖 Generated with Claude Code


Note

Medium Risk
Touches AWS client networking configuration (proxy/keepalive agent selection) for DynamoDB, which can impact connectivity and performance if misconfigured. Changes are small and covered by new unit tests for the new endpoint-detection branches.

Overview
Refactors DynamoDB client creation to remove the local setupHTTPAgent implementation and instead delegate keepalive/proxy agent setup to the shared utils.setHttpAgent, while preserving the existing bypassProxy/useKeepalives behavior (including erroring on proxy+keepalive and clearing any pre-set agent when keepalives are disabled).

Enhances setHttpAgent to detect HTTP vs HTTPS when config.endpoint is provided as a string (case-insensitive) in addition to AWS.Endpoint objects, and adds unit tests covering these DynamoDB and utility-agent selection scenarios.

Written by Cursor Bugbot for commit 9bc277e. This will update automatically on new commits. Configure here.

rafaelmatsumotomb and others added 2 commits March 11, 2026 18:28
… DynamoDB module

Remove duplicated setupHTTPAgent from DynamoDB module and delegate to
the shared setHttpAgent utility in lib/utils.js. Update setHttpAgent to
handle both string endpoints and AWS.Endpoint objects. Add test coverage
for string endpoint handling.

Closes #88

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Restore httpOptions guard in TF case to preserve original behavior
- Handle case-insensitive http:// string endpoints in setHttpAgent
- Add DynamoDB client tests for FT throw, TF agent deletion, default
  https agent, and http string endpoint cases
- Add utils test for uppercase HTTP string endpoint

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@rafaelmatsumotomb rafaelmatsumotomb marked this pull request as draft March 12, 2026 17:36
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.

refactor: reuse shared setHttpAgent utility in DynamoDB module

1 participant