Skip to content

Commit

Permalink
Show bug
Browse files Browse the repository at this point in the history
  • Loading branch information
binaryseed committed Apr 8, 2021
1 parent e34d392 commit ca9ee76
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions test/lib/absinthe/plug_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -630,6 +630,20 @@ defmodule Absinthe.PlugTest do
assert conn.private[:user_id] == 1
end

test "returns 400 with over encoded JSON string" do
opts = Absinthe.Plug.init(schema: TestSchema)

body = %{query: "{ item { name } }"} |> Jason.encode!() |> Jason.encode!() |> Jason.encode!()

assert %{status: 400, resp_body: resp_body} =
conn(:post, "/", body)
|> put_req_header("content-type", "application/json")
|> plug_parser
|> Absinthe.Plug.call(opts)

assert resp_body =~ "Expecting an object or"
end

defmodule NotaSchema do
end

Expand Down

0 comments on commit ca9ee76

Please sign in to comment.