Skip to content

fix(request): wrap HTTP adapters with Code.ensure_loaded? for optional deps#1193

Open
ManuzimFerreira wants to merge 1 commit intoex-aws:mainfrom
ManuzimFerreira:fix/req-undefined-warning
Open

fix(request): wrap HTTP adapters with Code.ensure_loaded? for optional deps#1193
ManuzimFerreira wants to merge 1 commit intoex-aws:mainfrom
ManuzimFerreira:fix/req-undefined-warning

Conversation

@ManuzimFerreira
Copy link

Problem

Users who don't use Req as their HTTP client see this warning during compilation:

warning: Req.request/1 is undefined (module Req is not available or is yet to be defined)
└─ lib/ex_aws/request/req.ex:22:12: ExAws.Request.Req.request/5

Solution

Wrap HTTP client adapter modules with if Code.ensure_loaded? so they are only defined when the optional dependency is available at compile time.

This follows the same pattern used by Tesla for optional adapters.

Changes

  • lib/ex_aws/request/req.ex - wrapped with if Code.ensure_loaded?(Req)
  • lib/ex_aws/request/hackney.ex - wrapped with if Code.ensure_loaded?(:hackney) for consistency

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.

1 participant