elixir-mint / mint

Functional HTTP client for Elixir with support for HTTP/1 and HTTP/2 🌱
Apache License 2.0
1.37k stars 112 forks source link

Allow atoms as headers #451

Closed amplexdenmark closed 1 month ago

amplexdenmark commented 1 month ago

I have the issue that elixir code produced using openapi-generator-cli uses atoms for header keys. I propose this change to handle that.

ericmj commented 1 month ago

This will mess with the logic that ensures we don't have duplicate keys, such as here: https://github.com/elixir-mint/mint/blob/50b11d668b6a240b0d9b20c67fbb41a10a7410b1/lib/mint/core/headers.ex#L94.

I think the right approach instead is to fix where mint is called by openapi-generator-cli (or tesla?).

whatyouhide commented 1 month ago

Agreed, we don't need to support atom headers. More importantly, to support them would make Mint less efficient since it would need to check for both string and atom header keys in a few places. With Mint being intended for low-level use cases, the right approach here is to fix this upstream as @ericmj mentioned. Thanks anyway @amplexdenmark 💟