diff --git a/handler.go b/handler.go index ce2d700..1a89994 100644 --- a/handler.go +++ b/handler.go @@ -13,9 +13,10 @@ import ( ) const ( - ContentTypeJSON = "application/json" - ContentTypeGraphQL = "application/graphql" - ContentTypeFormURLEncoded = "application/x-www-form-urlencoded" + ContentTypeJSON = "application/json" + ContentTypeGraphQL = "application/graphql" + ContentTypeFormURLEncoded = "application/x-www-form-urlencoded" + ContentTypeMultipartFormData = "multipart/form-data" ) type Handler struct { @@ -94,7 +95,15 @@ func NewRequestOptions(r *http.Request) *RequestOptions { } return &RequestOptions{} - + case ContentTypeMultipartFormData: + variables := make(map[string]interface{}, len(r.FormValue("variables"))) + variablesStr := r.FormValue("variables") + json.Unmarshal([]byte(variablesStr), &variables) + return &RequestOptions{ + Query: r.FormValue("query"), + Variables: variables, + OperationName: r.FormValue("operationName"), + } case ContentTypeJSON: fallthrough default: