strawberry-graphql 0.240.3__py3-none-any.whl → 0.240.3.dev1726159932__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -320,21 +320,21 @@ class AsyncBaseHTTPView(
320
320
  async def parse_http_body(
321
321
  self, request: AsyncHTTPRequestAdapter
322
322
  ) -> GraphQLRequestData:
323
- content_type, params = parse_content_type(request.content_type or "")
323
+ headers = {key.lower(): value for key, value in request.headers.items()}
324
+ content_type, _ = parse_content_type(request.content_type or "")
325
+ accept = headers.get("accept", "")
324
326
 
325
327
  protocol: Literal["http", "multipart-subscription"] = "http"
326
328
 
329
+ if self._is_multipart_subscriptions(*parse_content_type(accept)):
330
+ protocol = "multipart-subscription"
331
+
327
332
  if request.method == "GET":
328
333
  data = self.parse_query_params(request.query_params)
329
- if self._is_multipart_subscriptions(content_type, params):
330
- protocol = "multipart-subscription"
331
334
  elif "application/json" in content_type:
332
335
  data = self.parse_json(await request.get_body())
333
336
  elif content_type == "multipart/form-data":
334
337
  data = await self.parse_multipart(request)
335
- elif self._is_multipart_subscriptions(content_type, params):
336
- data = await self.parse_multipart_subscriptions(request)
337
- protocol = "multipart-subscription"
338
338
  else:
339
339
  raise HTTPException(400, "Unsupported content type")
340
340
 
@@ -123,14 +123,18 @@ async def _handle_execution_result(
123
123
  context: ExecutionContext,
124
124
  result: Union[GraphQLExecutionResult, ExecutionResult],
125
125
  extensions_runner: SchemaExtensionsRunner,
126
- process_errors: ProcessErrors | None,
126
+ process_errors: ProcessErrors,
127
127
  ) -> ExecutionResult:
128
128
  # Set errors on the context so that it's easier
129
129
  # to access in extensions
130
130
  if result.errors:
131
131
  context.errors = result.errors
132
- if process_errors:
133
- process_errors(result.errors, context)
132
+
133
+ # Run the `Schema.process_errors` function here before
134
+ # extensions have a chance to modify them (see the MaskErrors
135
+ # extension). That way we can log the original errors but
136
+ # only return a sanitised version to the client.
137
+ process_errors(result.errors, context)
134
138
  if isinstance(result, GraphQLExecutionResult):
135
139
  result = ExecutionResult(data=result.data, errors=result.errors)
136
140
  result.extensions = await extensions_runner.get_extensions_results(context)
@@ -167,7 +171,7 @@ async def execute(
167
171
  assert execution_context.graphql_document
168
172
  async with extensions_runner.executing():
169
173
  if not execution_context.result:
170
- result = await await_maybe(
174
+ res = await await_maybe(
171
175
  original_execute(
172
176
  schema,
173
177
  execution_context.graphql_document,
@@ -179,20 +183,9 @@ async def execute(
179
183
  execution_context_class=execution_context_class,
180
184
  )
181
185
  )
182
- execution_context.result = result
183
- else:
184
- result = execution_context.result
185
- # Also set errors on the execution_context so that it's easier
186
- # to access in extensions
187
- if result.errors:
188
- execution_context.errors = result.errors
189
-
190
- # Run the `Schema.process_errors` function here before
191
- # extensions have a chance to modify them (see the MaskErrors
192
- # extension). That way we can log the original errors but
193
- # only return a sanitised version to the client.
194
- process_errors(result.errors, execution_context)
195
186
 
187
+ else:
188
+ res = execution_context.result
196
189
  except (MissingQueryError, InvalidOperationTypeError) as e:
197
190
  raise e
198
191
  except Exception as exc:
@@ -202,9 +195,10 @@ async def execute(
202
195
  extensions_runner,
203
196
  process_errors,
204
197
  )
198
+
205
199
  # return results after all the operation completed.
206
200
  return await _handle_execution_result(
207
- execution_context, result, extensions_runner, None
201
+ execution_context, res, extensions_runner, process_errors
208
202
  )
209
203
 
210
204
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: strawberry-graphql
3
- Version: 0.240.3
3
+ Version: 0.240.3.dev1726159932
4
4
  Summary: A library for creating GraphQL APIs
5
5
  Home-page: https://strawberry.rocks/
6
6
  License: MIT
@@ -144,7 +144,7 @@ strawberry/file_uploads/utils.py,sha256=2zsXg3QsKgGLD7of2dW-vgQn_Naf7I3Men9PhEAF
144
144
  strawberry/flask/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
145
145
  strawberry/flask/views.py,sha256=Ss3zpBEjY5W6bR9SUPDbuF7zXErgn_qcXm0MuhzPS7k,5656
146
146
  strawberry/http/__init__.py,sha256=GSvHUDXl1cHfLnb37PXOAnxfoXhvz0f467P1O8uDatM,1620
147
- strawberry/http/async_base_view.py,sha256=huSretRZ-1WQLwZtHLMjUsdG9SSlW9AgE5jb1ivGr48,11837
147
+ strawberry/http/async_base_view.py,sha256=5CPdVkw-GcRa7JnTWh255QX8YDvd6re-JcxvYA2vNaE,11770
148
148
  strawberry/http/base.py,sha256=ORw-0lk6UcOH80kdr4VElAvX75S3VTMpRddhVfooGDY,2569
149
149
  strawberry/http/exceptions.py,sha256=WdWO3RvZDax_yAdD0zlVex9tQgwNx7tjz8_A8kP4YHo,193
150
150
  strawberry/http/ides.py,sha256=3dqFRY8_9ZqyIYR_EyRdPZ1zhL3lxRYT2MPk84O_Tk8,874
@@ -182,7 +182,7 @@ strawberry/schema/base.py,sha256=yarj62fhfCp0kToJPpWlNcCjyZV2CafbfpZ-yamjNVg,373
182
182
  strawberry/schema/compat.py,sha256=rRqUm5-XgPXC018_u0Mrd4iad7tTRCNA45Ko4NaT6gk,1836
183
183
  strawberry/schema/config.py,sha256=Aa01oqnHb0ZPlw8Ti_O840LxlT827LNio15BQrc37A0,717
184
184
  strawberry/schema/exceptions.py,sha256=rqVNb_oYrKM0dHPgvAemqCG6Um282LPPu4zwQ5cZqs4,584
185
- strawberry/schema/execute.py,sha256=EWNmu3hvlZMV2EWi8IbWVLUQYRH45AFB68DrOnx3BEI,11913
185
+ strawberry/schema/execute.py,sha256=XbArky5xmCWo_r2ootm8WREzzzZ0SsU9FoyfxA6Vc8g,11490
186
186
  strawberry/schema/name_converter.py,sha256=tpqw2XCSFvJI-H844iWhE2Z1sKic7DrjIZxt11eJN5Y,6574
187
187
  strawberry/schema/schema.py,sha256=rdsZrnAZZDV_eU_9s2K21hgROtP29GRt5MjUrwVBwyE,19034
188
188
  strawberry/schema/schema_converter.py,sha256=lckL2LoxAb6mNfJIVcerht2buzBG573ly3BHyl7wra4,36859
@@ -245,8 +245,8 @@ strawberry/utils/logging.py,sha256=U1cseHGquN09YFhFmRkiphfASKCyK0HUZREImPgVb0c,7
245
245
  strawberry/utils/operation.py,sha256=SSXxN-vMqdHO6W2OZtip-1z7y4_A-eTVFdhDvhKeLCk,1193
246
246
  strawberry/utils/str_converters.py,sha256=KGd7QH90RevaJjH6SQEkiVVsb8KuhJr_wv5AsI7UzQk,897
247
247
  strawberry/utils/typing.py,sha256=3xws5kxSQGsp8BnYyUwClvxXNzZakMAuOPoq1rjHRuk,14252
248
- strawberry_graphql-0.240.3.dist-info/LICENSE,sha256=m-XnIVUKqlG_AWnfi9NReh9JfKhYOB-gJfKE45WM1W8,1072
249
- strawberry_graphql-0.240.3.dist-info/METADATA,sha256=vIEPpDXtPLX77d5XG2XgAYcTSry509jvxIS0kR0Hd1U,7707
250
- strawberry_graphql-0.240.3.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
251
- strawberry_graphql-0.240.3.dist-info/entry_points.txt,sha256=Nk7-aT3_uEwCgyqtHESV9H6Mc31cK-VAvhnQNTzTb4k,49
252
- strawberry_graphql-0.240.3.dist-info/RECORD,,
248
+ strawberry_graphql-0.240.3.dev1726159932.dist-info/LICENSE,sha256=m-XnIVUKqlG_AWnfi9NReh9JfKhYOB-gJfKE45WM1W8,1072
249
+ strawberry_graphql-0.240.3.dev1726159932.dist-info/METADATA,sha256=OGhqrqrIWMS0ConpfeIpGizFZUl2KdeUMOC9aGvdEIg,7721
250
+ strawberry_graphql-0.240.3.dev1726159932.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
251
+ strawberry_graphql-0.240.3.dev1726159932.dist-info/entry_points.txt,sha256=Nk7-aT3_uEwCgyqtHESV9H6Mc31cK-VAvhnQNTzTb4k,49
252
+ strawberry_graphql-0.240.3.dev1726159932.dist-info/RECORD,,