@@ -39,17 +39,41 @@ internal static FormUrlEncodedContent ToFormUrlEncodedContent(GraphQLRequest req
39
39
dictionary [ "variables" ] = ToJson ( request . Variables ) ;
40
40
}
41
41
42
+ if ( request . Extensions != null )
43
+ {
44
+ dictionary [ "extensions" ] = ToJson ( request . Extensions ) ;
45
+ }
46
+
42
47
return new FormUrlEncodedContent ( dictionary ) ;
43
48
}
44
49
45
50
internal static Task < string > ToQueryStringParamsAsync ( GraphQLRequest request )
46
51
=> ToFormUrlEncodedContent ( request ) . ReadAsStringAsync ( ) ;
47
52
48
53
private static Dictionary < string , object > ToDictionary ( this GraphQLRequest request )
49
- => new Dictionary < string , object >
54
+ {
55
+ var dictionary = new Dictionary < string , object > ( ) ;
56
+
57
+ if ( request . OperationName != null )
58
+ {
59
+ dictionary [ "operationName" ] = request . OperationName ;
60
+ }
61
+
62
+ if ( request . Query != null )
50
63
{
51
- { "operationName" , request . OperationName } ,
52
- { "query" , request . Query } ,
53
- { "variables" , request . Variables }
54
- } ;
64
+ dictionary [ "query" ] = request . Query ;
65
+ }
66
+
67
+ if ( request . Variables != null )
68
+ {
69
+ dictionary [ "variables" ] = request . Variables ;
70
+ }
71
+
72
+ if ( request . Extensions != null )
73
+ {
74
+ dictionary [ "extensions" ] = request . Extensions ;
75
+ }
76
+
77
+ return dictionary ;
78
+ }
55
79
}
0 commit comments