Plug test messing up body request

All you say is likely true – not doubting you or the docs – but in my case I have a pipeline in my router like so:

  pipeline :api_v1 do
    plug :accepts, ["json"]
  end

And then in the router again:

  scope "/api/v1/commands", MyAppWeb.API.V1.Commands do
    pipe_through :api_v1

    post "/schedule", CommandController, :schedule
  end

And the test is like so:

  test "succeeds with valid XXX command arguments", %{conn: conn} do
    command = Jason.decode!(@command_fixture_xxx_1)
    conn = post(conn, ~p"/api/v1/commands/schedule", command)
    assert json_response(conn, :ok) == %{}
  end

…and I can post a normal map without having to Jason.encode! it first.

@henriquesati I haven’t followed the entire thread but have you tried with a pipeline that has plug :accepts, ["json"] in it?