diff --git a/lib/req/steps.ex b/lib/req/steps.ex index d3defa5..502180c 100644 --- a/lib/req/steps.ex +++ b/lib/req/steps.ex @@ -1022,7 +1022,7 @@ defmodule Req.Steps do conn = Req.Test.Adapter.conn(%Plug.Conn{}, request.method, request.url, req_body) |> Map.replace!(:req_headers, req_headers) - |> Plug.Conn.fetch_query_params() + |> Plug.Conn.fetch_query_params(validate_utf8: false) |> Plug.Parsers.call(parser_opts) # Handle cases where the body isn't read with Plug.Parsers diff --git a/test/req/steps_test.exs b/test/req/steps_test.exs index 3bb5281..8fc4ef3 100644 --- a/test/req/steps_test.exs +++ b/test/req/steps_test.exs @@ -1875,10 +1875,11 @@ defmodule Req.StepsTest do plug = fn conn -> {:ok, body, conn} = Plug.Conn.read_body(conn) assert body == ~s|{"a":1}| + assert conn.query_params == %{"foo" => <<0xFF>>} Plug.Conn.send_resp(conn, 200, "ok") end - assert Req.request!(plug: plug, json: %{a: 1}).body == "ok" + assert Req.request!(plug: plug, json: %{a: 1}, params: %{foo: <<0xFF>>}).body == "ok" refute_receive _ end