Skip to content

Commit a3fe568

Browse files
ruxojoemcbride
authored andcommitted
Use JObject so GraphQLQuery can be deserializable passing object as variables. (graphql-dotnet#530)
Since GraphQL tool pass query parameter as an object, somehow this makes deserialization of query parameter failed as null. Changing it JObject to guarantee success.
1 parent 602254e commit a3fe568

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/GraphQL.GraphiQL/Controllers/GraphQLController.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using System.Collections.Generic;
1+
using System.Collections.Generic;
22
using System.Net;
33
using System.Net.Http;
44
using System.Text;
@@ -38,7 +38,7 @@ public GraphQLController(
3838
[HttpGet]
3939
public Task<HttpResponseMessage> GetAsync(HttpRequestMessage request)
4040
{
41-
return PostAsync(request, new GraphQLQuery { Query = "query foo { hero }", Variables = "" });
41+
return PostAsync(request, new GraphQLQuery { Query = "query foo { hero }", Variables = null });
4242
}
4343

4444
[HttpPost]
@@ -82,6 +82,6 @@ public class GraphQLQuery
8282
public string OperationName { get; set; }
8383
public string NamedQuery { get; set; }
8484
public string Query { get; set; }
85-
public string Variables { get; set; }
85+
public Newtonsoft.Json.Linq.JObject Variables { get; set; }
8686
}
8787
}

0 commit comments

Comments
 (0)