When testing GraphQL mutation, and if the mutation returns %{error: "error message"}
, we should expect json_response(conn, 200)
to return the following json data:
{
"data": {
"someMutation": null
},
"errors": [
{
"locations": [
{
"column": 3,
"line": 2
}
],
"message": "error message",
"path": [
"someMutation"
]
}
]
}
But this is not the case with {:phoenix, "~> 1.6.9"}
, {:absinthe, "~> 1.6.0"}
, and {:absinthe_plug, "~> 1.5"}
. Phoenix tries to render the error view instead of returning the above-mentioned json data, even if, I set render_errors
to false
in the endpoint config.
Does anyone have any idea how to resolve this issue?