File tree Expand file tree Collapse file tree 1 file changed +14
-5
lines changed Expand file tree Collapse file tree 1 file changed +14
-5
lines changed Original file line number Diff line number Diff line change @@ -13,13 +13,14 @@ import (
1313)
1414
1515const (
16- ContentTypeJSON = "application/json"
17- ContentTypeGraphQL = "application/graphql"
18- ContentTypeFormURLEncoded = "application/x-www-form-urlencoded"
16+ ContentTypeJSON = "application/json"
17+ ContentTypeGraphQL = "application/graphql"
18+ ContentTypeFormURLEncoded = "application/x-www-form-urlencoded"
19+ ContentTypeMultipartFormData = "multipart/form-data"
1920)
2021
2122type Handler struct {
22- Schema * graphql.Schema
23+ Schema * graphql.Schema
2324 pretty bool
2425 graphiql bool
2526}
@@ -92,7 +93,15 @@ func NewRequestOptions(r *http.Request) *RequestOptions {
9293 }
9394
9495 return & RequestOptions {}
95-
96+ case ContentTypeMultipartFormData :
97+ variables := make (map [string ]interface {}, len (r .FormValue ("variables" )))
98+ variablesStr := r .FormValue ("variables" )
99+ json .Unmarshal ([]byte (variablesStr ), & variables )
100+ return & RequestOptions {
101+ Query : r .FormValue ("query" ),
102+ Variables : variables ,
103+ OperationName : r .FormValue ("operationName" ),
104+ }
96105 case ContentTypeJSON :
97106 fallthrough
98107 default :
You can’t perform that action at this time.
0 commit comments