You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
httpResponse.StatusCode=resultis not ExecutionResultexecutionResult||executionResult.Executed?200:400;// BadRequest when fails validation; OK otherwise
@@ -90,7 +89,7 @@ public async Task Wrong_Query_Should_Return_Error(HttpMethod httpMethod, HttpCon
90
89
HttpMethod.Put,
91
90
newStringContent(Serializer.ToJson(newGraphQLRequest{Query="query { __schema { queryType { name } } }"}),Encoding.UTF8,"application/json"),
92
91
HttpStatusCode.MethodNotAllowed,
93
-
"Invalid HTTP method. Only GET and POST are supported. See: http://graphql.org/learn/serving-over-http/.",
92
+
@"{""errors"":[{""message"":""Invalid HTTP method. Only GET and POST are supported. See: http://graphql.org/learn/serving-over-http/.""}]}",
94
93
},
95
94
96
95
// POST with unsupported mime type should be a unsupported media type
@@ -99,7 +98,7 @@ public async Task Wrong_Query_Should_Return_Error(HttpMethod httpMethod, HttpCon
99
98
HttpMethod.Post,
100
99
newStringContent(Serializer.ToJson(newGraphQLRequest{Query="query { __schema { queryType { name } } }"}),Encoding.UTF8,"something/unknown"),
101
100
HttpStatusCode.UnsupportedMediaType,
102
-
"Invalid 'Content-Type' header: non-supported media type 'something/unknown; charset=utf-8'. Must be of 'application/json', 'application/graphql' or 'application/x-www-form-urlencoded'. See: http://graphql.org/learn/serving-over-http/."
101
+
@"{""errors"":[{""message"":""Invalid 'Content-Type' header: non-supported media type 'something/unknown; charset=utf-8'. Must be of 'application/json', 'application/graphql' or 'application/x-www-form-urlencoded'. See: http://graphql.org/learn/serving-over-http/.""}]}"
103
102
},
104
103
105
104
// MediaTypeHeaderValue ctor throws exception
@@ -118,7 +117,7 @@ public async Task Wrong_Query_Should_Return_Error(HttpMethod httpMethod, HttpCon
"JSON body text could not be parsed. 'O' is an invalid start of a value. Path: $ | LineNumber: 0 | BytePositionInLine: 0."
120
+
@"{""errors"":[{""message"":""JSON body text could not be parsed. 'O' is an invalid start of a value. Path: $ | LineNumber: 0 | BytePositionInLine: 0.""}]}"
122
121
},
123
122
124
123
// POST with JSON mime type that is invalid JSON should be a bad request
@@ -127,7 +126,7 @@ public async Task Wrong_Query_Should_Return_Error(HttpMethod httpMethod, HttpCon
"JSON body text could not be parsed. 'o' is an invalid start of a property name. Expected a '\"'. Path: $ | LineNumber: 0 | BytePositionInLine: 1."
129
+
@"{""errors"":[{""message"":""JSON body text could not be parsed. 'o' is an invalid start of a property name. Expected a '""'. Path: $ | LineNumber: 0 | BytePositionInLine: 1.""}]}"
131
130
},
132
131
133
132
// POST with JSON mime type that is null JSON should be a bad request
@@ -136,7 +135,7 @@ public async Task Wrong_Query_Should_Return_Error(HttpMethod httpMethod, HttpCon
@"{""errors"":[{""message"":""Error parsing query: Expected \u0022query/mutation/subscription/fragment/schema/scalar/type/interface/union/enum/input/extend/directive\u0022, found Name \u0022parseError\u0022"",""locations"":[{""line"":1,""column"":1}],""extensions"":{""code"":""SYNTAX_ERROR"",""codes"":[""SYNTAX_ERROR""]}}]}"
157
+
},
158
+
159
+
// POST with no operation should be a bad request
160
+
newobject[]
161
+
{
162
+
HttpMethod.Post,
163
+
newStringContent(@"{""query"":""fragment frag on Query { hello }""}",Encoding.UTF8,"application/json"),
164
+
HttpStatusCode.BadRequest,
165
+
@"{""errors"":[{""message"":""Document does not contain any operations."",""extensions"":{""code"":""NO_OPERATION"",""codes"":[""NO_OPERATION""]}}]}"
166
+
},
167
+
168
+
// POST with validation error should be a bad request
@"{""errors"":[{""message"":""Cannot query field \u0027dummy\u0027 on type \u0027ChatQuery\u0027."",""locations"":[{""line"":1,""column"":3}],""extensions"":{""code"":""FIELDS_ON_CORRECT_TYPE"",""codes"":[""FIELDS_ON_CORRECT_TYPE""],""number"":""5.3.1""}}]}"
0 commit comments