I’m trying to set the header with an addition value in a phoenix unit (integration) test:
@tag integration: true
test "should record the incoming request made to forwarding service" do
conn_with_api_header = build_conn()
|> Plug.Conn.put_req_header("x-mashape-key", "some_test_key" )
conn = post(conn_with_api_header, "/api/cards")
end
When I run the test I’m getting the following error:
** (ArgumentError) argument error
code: conn = post(conn_with_api_header, “/api/cards”)
stacktrace:
:erlang.iolist_to_binary([{“x-mashape-key”, “some_test_key”}])
Does anyone know how to set or add entries to the header when testing endpoints? I didn’t see anything in the docs that allows this option.
Wow, you nailed it without even seeing the code! My test was actually doing the correct thing and I was assuming my test was wrong shakes head. After looking at the rest of the call stack I realize I was looking in the wrong place: