Skip to content
Closed
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
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 All @@ -42,7 +42,7 @@ func getFromForm(values url.Values) *RequestOptions {
// get variables map
var variables map[string]interface{}
variablesStr := values.Get("variables")
json.Unmarshal([]byte(variablesStr), variables)
json.Unmarshal([]byte(variablesStr), &variables)

return &RequestOptions{
Query: query,
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,7 +137,7 @@ func (h *Handler) ContextHandler(ctx context.Context, w http.ResponseWriter, r *
} else {
w.WriteHeader(http.StatusOK)
buff, _ := json.Marshal(result)

w.Write(buff)
}
}
Expand Down