Httpc.request/4 isn't working - can't find error documented anywhere

Anyone know why I’m getting this error when calling httpc.request/4?

01:25:47.202 [error] [libcluster:hiven_consul] request to Consul failed!: {:headers_error, :not_strings}

Here is the headers variable:
[{"authorization", "Bearer <stripped>"}]

code:

case :httpc.request(:get, {to_charlist(url), headers}, [], []) do

I think your headers must be charlists too.

so
[{to_charlist("authorization"), to_charlist("Bearer ...")}] should work

1 Like

That does actually work, but it’s weird because this is part of a library which I’ve used before and it seemed to work fine. Thank you though :slight_smile: