Skip to content

Commit 1e3fff8

Browse files
committed
Do not include 'extensions' in validation condition
as it is an optional field
1 parent a0e0506 commit 1e3fff8

File tree

3 files changed

+4
-17
lines changed

3 files changed

+4
-17
lines changed

gql/transport/aiohttp.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -228,11 +228,7 @@ async def execute(
228228
f"Server did not return a GraphQL result: {result_text}"
229229
)
230230

231-
if (
232-
"errors" not in result
233-
and "data" not in result
234-
and "extensions" not in result
235-
):
231+
if "errors" not in result and "data" not in result:
236232
result_text = await resp.text()
237233
raise TransportProtocolError(
238234
"Server did not return a GraphQL result: "

gql/transport/requests.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -168,11 +168,7 @@ def execute( # type: ignore
168168

169169
raise TransportProtocolError("Server did not return a GraphQL result")
170170

171-
if (
172-
"errors" not in result
173-
and "data" not in result
174-
and "extensions" not in result
175-
):
171+
if "errors" not in result and "data" not in result:
176172
raise TransportProtocolError("Server did not return a GraphQL result")
177173

178174
return ExecutionResult(

gql/transport/websockets.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -297,14 +297,9 @@ def _parse_answer(
297297

298298
if answer_type == "data":
299299

300-
if (
301-
"errors" not in payload
302-
and "data" not in payload
303-
and "extensions" not in payload
304-
):
300+
if "errors" not in payload and "data" not in payload:
305301
raise ValueError(
306-
"payload does not contain 'data' or 'errors' "
307-
"or 'extensions' fields"
302+
"payload does not contain 'data' or 'errors' fields"
308303
)
309304

310305
execution_result = ExecutionResult(

0 commit comments

Comments
 (0)