Skip to content

Commit be9949c

Browse files
⚡️ Speed up function process_result by 100% in PR #3819 (feature/defer) (#3827)
Co-authored-by: codeflash-ai[bot] <148906541+codeflash-ai[bot]@users.noreply.github.com>
1 parent 36bc1a9 commit be9949c

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

strawberry/http/__init__.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,12 @@ def process_result(result: ResultType) -> GraphQLHTTPResponse:
2020
if isinstance(result, GraphQLIncrementalExecutionResults):
2121
return result
2222

23-
data: GraphQLHTTPResponse = {"data": result.data}
24-
25-
if result.errors:
26-
data["errors"] = [err.formatted for err in result.errors]
27-
if result.extensions:
28-
data["extensions"] = result.extensions
23+
errors, extensions = result.errors, result.extensions
24+
data: GraphQLHTTPResponse = {
25+
"data": result.data,
26+
**({"errors": [err.formatted for err in errors]} if errors else {}),
27+
**({"extensions": extensions} if extensions else {}),
28+
}
2929

3030
return data
3131

0 commit comments

Comments
 (0)