INNER CODE UNIT · Go
TestDoBadRequestErr
machinebox/graphql · graphql_multipart_test.go:143
func TestDoBadRequestErr(t *testing.T) {
is := is.New(t)
var calls int
srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
calls++
is.Equal(r.Method, http.MethodPost)
query := r.FormValue("query")
is.Equal(query, `query {}`)
w.WriteHeader(http.StatusBadRequest)
io.WriteString(w, `{
"errors": [{
"message": "miscellaneous message as to why the the request was bad"
}]
}`)
}))
defer srv.Close()
ctx := context.Background()