Skip to content

variables in the URL query string are now correctly unmarshalled #10

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
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