If the value of header is nil it will just throw error.
** (ErlangError) Erlang error: {:bad_generator, nil}
(mint 1.5.1) lib/mint/http1/request.ex:85: Mint.HTTP1.Request."-validate_header_value!/2-lc$^0/1-0-"/3
(mint 1.5.1) lib/mint/http1/request.ex:85: Mint.HTTP1.Request.validate_header_value!/2
(mint 1.5.1) lib/mint/http1/request.ex:27: anonymous fn/2 in Mint.HTT
# . . . Stack strace
I think I could make a bug reproducing repo in free time, but what caused this in my case is a dependency.
In dependency, there is macro @api_key Application.compile_env(:my_app, :api_key) (yes I know I shouldn't use that, I will change it) which requires setting it in somewhere in config.exs but if I don't do that header value becomes nil and bum bug. :)
In my config, I use System.get_env to fetch header value
I am using Tesla with Finch adapter