diff --git a/.travis.yml b/.travis.yml index 8a7d954..8b1720f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,6 +2,7 @@ language: go go: - 1.7 + - 1.8 - tip before_install: diff --git a/handler.go b/handler.go index 13a8fa0..eb6d338 100644 --- a/handler.go +++ b/handler.go @@ -20,7 +20,7 @@ const ( type Handler struct { Schema *graphql.Schema - + pretty bool } type RequestOptions struct { @@ -129,7 +129,6 @@ func (h *Handler) ContextHandler(ctx context.Context, w http.ResponseWriter, r * } result := graphql.Do(params) - if h.pretty { w.WriteHeader(http.StatusOK) buff, _ := json.MarshalIndent(result, "", "\t") @@ -138,14 +137,14 @@ func (h *Handler) ContextHandler(ctx context.Context, w http.ResponseWriter, r * } else { w.WriteHeader(http.StatusOK) buff, _ := json.Marshal(result) - + w.Write(buff) } } // ServeHTTP provides an entrypoint into executing graphQL queries. func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) { - h.ContextHandler(context.Background(), w, r) + h.ContextHandler(r.Context(), w, r) } type Config struct {