So, Conn.get_req_header/2
returns [binary()]
and I’m trying to figure out how to properly test multiple instances of a header with Plug.Test
. Using Conn.Test.put_req_header/3
twice overwrites the header, and doesn’t add the second instance of the header, and it accepts only a single binary()
as the value.
This does not work:
conn =
"get"
|> conn("/")
|> put_req_header("test-header", "v1")
|> put_req_header("test-header", "v2")
|> call()
When get_req_header("test-header")
is called, I would expect ["v1", "v2"]
, but instead get ["v2"]
.
This does not compile:
conn =
"get"
|> conn("/")
|> put_req_header("test-header", ["v1", "v2"])
|> call()
Any suggestions?