diff --git a/handler.go b/handler.go index a61a872..53a9f3c 100644 --- a/handler.go +++ b/handler.go @@ -138,6 +138,9 @@ func (h *Handler) ContextHandler(ctx context.Context, w http.ResponseWriter, r * } } + // use proper JSON Header + w.Header().Add("Content-Type", "application/json") + if h.pretty { w.WriteHeader(http.StatusOK) buff, _ := json.MarshalIndent(result, "", "\t") diff --git a/handler_test.go b/handler_test.go index 7c8a60b..ea73d2a 100644 --- a/handler_test.go +++ b/handler_test.go @@ -10,10 +10,10 @@ import ( "strings" "testing" + "context" "github.com/graphql-go/graphql" "github.com/graphql-go/graphql/testutil" "github.com/graphql-go/handler" - "context" ) func decodeResponse(t *testing.T, recorder *httptest.ResponseRecorder) *graphql.Result {