Skip to content

refactor: reuse shared setHttpAgent utility in DynamoDB module #88

@rafaelmatsumotomb

Description

@rafaelmatsumotomb

Summary

The DynamoDB module (lib/dynamo/index.js) has its own setupHTTPAgent function that duplicates the HTTP agent setup logic already available in the shared setHttpAgent utility (lib/utils.js).

This duplication was introduced when adding support for http.Agent on non-HTTPS endpoints (e.g., local DynamoDB). The same logic already exists in lib/utils.js and is used by the SQS module.

Proposed Changes

  • Update setHttpAgent in lib/utils.js to handle both string endpoints ('http://localhost:8000') and AWS.Endpoint objects ({ protocol: 'http:' })
  • Refactor lib/dynamo/index.js to remove the duplicated setupHTTPAgent and delegate to the shared setHttpAgent
  • Add test coverage for string endpoint handling in utils.spec.js

🤖 Generated with Claude Code

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions