Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ language: go

go:
- 1.7
- 1.8
- tip

before_install:
Expand Down
7 changes: 3 additions & 4 deletions handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const (

type Handler struct {
Schema *graphql.Schema

pretty bool
}
type RequestOptions struct {
Expand Down Expand Up @@ -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")
Expand All @@ -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 {
Expand Down