I have a test like this:
conn =
conn
|> put_req_header("content-type", "invalid")
|> put_req_header("x-auth-token", "token")
|> post(~p"/api/invoice/foo", %{})
and it results in body_params
to be filled in with %{}
.
But if I run a request like that through a tool body_params
is %Plug.Conn.Unfetched{}
- because the content type is not correct.
How do I get the same behaviour in the test? Is the post
call overwriting the content-type
req header again? (It doesn’t look like it when I inspect the conn
, but I can’t find a different reason why it might have different behaviour?