strawberry-graphql 0.239.0__py3-none-any.whl → 0.239.1__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.
@@ -189,18 +189,18 @@ class GraphQLView(
189
189
 
190
190
  return sub_response
191
191
 
192
- async def create_multipart_response(
192
+ async def create_streaming_response(
193
193
  self,
194
194
  request: web.Request,
195
195
  stream: Callable[[], AsyncGenerator[str, None]],
196
196
  sub_response: web.Response,
197
+ headers: Dict[str, str],
197
198
  ) -> web.StreamResponse:
198
199
  response = web.StreamResponse(
199
200
  status=sub_response.status,
200
201
  headers={
201
202
  **sub_response.headers,
202
- "Transfer-Encoding": "chunked",
203
- "Content-type": "multipart/mixed;boundary=graphql;subscriptionSpec=1.0,application/json",
203
+ **headers,
204
204
  },
205
205
  )
206
206
 
@@ -7,6 +7,7 @@ from typing import (
7
7
  Any,
8
8
  AsyncIterator,
9
9
  Callable,
10
+ Dict,
10
11
  Mapping,
11
12
  Optional,
12
13
  Sequence,
@@ -221,18 +222,18 @@ class GraphQL(
221
222
 
222
223
  return response
223
224
 
224
- async def create_multipart_response(
225
+ async def create_streaming_response(
225
226
  self,
226
227
  request: Request | WebSocket,
227
228
  stream: Callable[[], AsyncIterator[str]],
228
229
  sub_response: Response,
230
+ headers: Dict[str, str],
229
231
  ) -> Response:
230
232
  return StreamingResponse(
231
233
  stream(),
232
- status_code=sub_response.status_code,
234
+ status_code=sub_response.status_code or status.HTTP_200_OK,
233
235
  headers={
234
236
  **sub_response.headers,
235
- "Transfer-Encoding": "chunked",
236
- "Content-type": "multipart/mixed;boundary=graphql;subscriptionSpec=1.0,application/json",
237
+ **headers,
237
238
  },
238
239
  )
@@ -273,15 +273,23 @@ class GraphQLHTTPConsumer(
273
273
  async def get_sub_response(self, request: ChannelsRequest) -> TemporalResponse:
274
274
  return TemporalResponse()
275
275
 
276
- async def create_multipart_response(
276
+ async def create_streaming_response(
277
277
  self,
278
278
  request: ChannelsRequest,
279
279
  stream: Callable[[], AsyncGenerator[str, None]],
280
280
  sub_response: TemporalResponse,
281
+ headers: Dict[str, str],
281
282
  ) -> MultipartChannelsResponse:
282
283
  status = sub_response.status_code or 200
283
- headers = {k.encode(): v.encode() for k, v in sub_response.headers.items()}
284
- return MultipartChannelsResponse(stream=stream, status=status, headers=headers)
284
+
285
+ response_headers = {
286
+ k.encode(): v.encode() for k, v in sub_response.headers.items()
287
+ }
288
+ response_headers.update({k.encode(): v.encode() for k, v in headers.items()})
289
+
290
+ return MultipartChannelsResponse(
291
+ stream=stream, status=status, headers=response_headers
292
+ )
285
293
 
286
294
  async def render_graphql_ide(self, request: ChannelsRequest) -> ChannelsResponse:
287
295
  return ChannelsResponse(
@@ -7,6 +7,7 @@ from typing import (
7
7
  Any,
8
8
  AsyncIterator,
9
9
  Callable,
10
+ Dict,
10
11
  Mapping,
11
12
  Optional,
12
13
  Union,
@@ -185,19 +186,19 @@ class BaseView:
185
186
 
186
187
  return response
187
188
 
188
- async def create_multipart_response(
189
+ async def create_streaming_response(
189
190
  self,
190
191
  request: HttpRequest,
191
192
  stream: Callable[[], AsyncIterator[Any]],
192
193
  sub_response: TemporalHttpResponse,
194
+ headers: Dict[str, str],
193
195
  ) -> HttpResponseBase:
194
196
  return StreamingHttpResponse(
195
197
  streaming_content=stream(),
196
198
  status=sub_response.status_code,
197
199
  headers={
198
200
  **sub_response.headers,
199
- "Transfer-Encoding": "chunked",
200
- "Content-type": "multipart/mixed;boundary=graphql;subscriptionSpec=1.0,application/json",
201
+ **headers,
201
202
  },
202
203
  )
203
204
 
@@ -332,19 +332,19 @@ class GraphQLRouter(
332
332
 
333
333
  return response
334
334
 
335
- async def create_multipart_response(
335
+ async def create_streaming_response(
336
336
  self,
337
337
  request: Request,
338
338
  stream: Callable[[], AsyncIterator[str]],
339
339
  sub_response: Response,
340
+ headers: Dict[str, str],
340
341
  ) -> Response:
341
342
  return StreamingResponse(
342
343
  stream(),
343
- status_code=sub_response.status_code,
344
+ status_code=sub_response.status_code or status.HTTP_200_OK,
344
345
  headers={
345
346
  **sub_response.headers,
346
- "Transfer-Encoding": "chunked",
347
- "Content-type": "multipart/mixed;boundary=graphql;subscriptionSpec=1.0,application/json",
347
+ **headers,
348
348
  },
349
349
  )
350
350
 
@@ -92,11 +92,12 @@ class AsyncBaseHTTPView(
92
92
  @abc.abstractmethod
93
93
  async def render_graphql_ide(self, request: Request) -> Response: ...
94
94
 
95
- async def create_multipart_response(
95
+ async def create_streaming_response(
96
96
  self,
97
97
  request: Request,
98
98
  stream: Callable[[], AsyncGenerator[str, None]],
99
99
  sub_response: SubResponse,
100
+ headers: Dict[str, str],
100
101
  ) -> Response:
101
102
  raise ValueError("Multipart responses are not supported")
102
103
 
@@ -199,7 +200,15 @@ class AsyncBaseHTTPView(
199
200
  if isinstance(result, SubscriptionExecutionResult):
200
201
  stream = self._get_stream(request, result)
201
202
 
202
- return await self.create_multipart_response(request, stream, sub_response)
203
+ return await self.create_streaming_response(
204
+ request,
205
+ stream,
206
+ sub_response,
207
+ headers={
208
+ "Transfer-Encoding": "chunked",
209
+ "Content-Type": "multipart/mixed;boundary=graphql;subscriptionSpec=1.0,application/json",
210
+ },
211
+ )
203
212
 
204
213
  response_data = await self.process_result(request=request, result=result)
205
214
 
@@ -280,19 +280,19 @@ class GraphQLController(
280
280
 
281
281
  return response
282
282
 
283
- async def create_multipart_response(
283
+ async def create_streaming_response(
284
284
  self,
285
285
  request: Request,
286
286
  stream: Callable[[], AsyncIterator[str]],
287
287
  sub_response: Response,
288
+ headers: Dict[str, str],
288
289
  ) -> Response:
289
290
  return Stream(
290
291
  stream(),
291
292
  status_code=sub_response.status_code,
292
293
  headers={
293
294
  **sub_response.headers,
294
- "Transfer-Encoding": "chunked",
295
- "Content-type": "multipart/mixed;boundary=graphql;subscriptionSpec=1.0,application/json",
295
+ **headers,
296
296
  },
297
297
  )
298
298
 
strawberry/quart/views.py CHANGED
@@ -1,6 +1,6 @@
1
1
  import warnings
2
2
  from collections.abc import Mapping
3
- from typing import TYPE_CHECKING, AsyncGenerator, Callable, Optional, cast
3
+ from typing import TYPE_CHECKING, AsyncGenerator, Callable, Dict, Optional, cast
4
4
 
5
5
  from quart import Request, Response, request
6
6
  from quart.views import View
@@ -103,19 +103,19 @@ class GraphQLView(
103
103
  status=e.status_code,
104
104
  )
105
105
 
106
- async def create_multipart_response(
106
+ async def create_streaming_response(
107
107
  self,
108
108
  request: Request,
109
109
  stream: Callable[[], AsyncGenerator[str, None]],
110
110
  sub_response: Response,
111
+ headers: Dict[str, str],
111
112
  ) -> Response:
112
113
  return (
113
114
  stream(),
114
115
  sub_response.status_code,
115
116
  { # type: ignore
116
117
  **sub_response.headers,
117
- "Transfer-Encoding": "chunked",
118
- "Content-type": "multipart/mixed;boundary=graphql;subscriptionSpec=1.0,application/json",
118
+ **headers,
119
119
  },
120
120
  )
121
121
 
strawberry/sanic/views.py CHANGED
@@ -178,18 +178,18 @@ class GraphQLView(
178
178
  except HTTPException as e:
179
179
  return HTTPResponse(e.reason, status=e.status_code)
180
180
 
181
- async def create_multipart_response(
181
+ async def create_streaming_response(
182
182
  self,
183
183
  request: Request,
184
184
  stream: Callable[[], AsyncGenerator[str, None]],
185
185
  sub_response: TemporalResponse,
186
+ headers: Dict[str, str],
186
187
  ) -> HTTPResponse:
187
188
  response = await self.request.respond(
188
- content_type="multipart/mixed;boundary=graphql;subscriptionSpec=1.0,application/json",
189
189
  status=sub_response.status_code,
190
190
  headers={
191
191
  **sub_response.headers,
192
- "Transfer-Encoding": "chunked",
192
+ **headers,
193
193
  },
194
194
  )
195
195
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: strawberry-graphql
3
- Version: 0.239.0
3
+ Version: 0.239.1
4
4
  Summary: A library for creating GraphQL APIs
5
5
  Home-page: https://strawberry.rocks/
6
6
  License: MIT
@@ -6,9 +6,9 @@ strawberry/aiohttp/handlers/graphql_transport_ws_handler.py,sha256=-dihpF3pueV6j
6
6
  strawberry/aiohttp/handlers/graphql_ws_handler.py,sha256=Ol8tBLIeal7bRiG_uxyJXnXo24xMDEh6M5XsuCyUpVQ,2275
7
7
  strawberry/aiohttp/test/__init__.py,sha256=4xxdUZtIISSOwjrcnmox7AvT4WWjowCm5bUuPdQneMg,71
8
8
  strawberry/aiohttp/test/client.py,sha256=4vjTDxtNVfpa74GfUUO7efPI6Ssh1vzfCYp3tPA-SLk,1357
9
- strawberry/aiohttp/views.py,sha256=aBt5xMZ_ocZfawy0v9EDHO8mtjQu1QUiI_oQ_W3AmaQ,7030
9
+ strawberry/aiohttp/views.py,sha256=9-oVlT-DVQL9bGiV0uY6lBCRz7KtQDA_nPPk-M0HH2w,6936
10
10
  strawberry/annotation.py,sha256=ftSxGZQUk4C5_5YRM_wNJFVVnZi0XOp71kD7zv4oxbU,13077
11
- strawberry/asgi/__init__.py,sha256=7jMvOuKS-5V7FLCG4EyGCswAEN8AwjInxEnaVlgy52M,7588
11
+ strawberry/asgi/__init__.py,sha256=gtAP5BF7z0lnxoKDeprEv2tuffjDRWNx2Xc2v-B6Prg,7526
12
12
  strawberry/asgi/handlers/__init__.py,sha256=rz5Gth2eJUn7tDq2--99KSNFeMdDPpLFCkfA7vge0cI,235
13
13
  strawberry/asgi/handlers/graphql_transport_ws_handler.py,sha256=_5N58XdtCZndU81ky1f5cwG9E4NhysxP4uHlqqZNzn4,2147
14
14
  strawberry/asgi/handlers/graphql_ws_handler.py,sha256=KQXmbk7uDwiG1yOadz65GsSzjAPUjKrpEQYAA94nGRM,2379
@@ -21,7 +21,7 @@ strawberry/channels/handlers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NM
21
21
  strawberry/channels/handlers/base.py,sha256=DlMmzuZl-feceZZ7UHLW-zBSNVxHvaWTqwyWDP-e1Dg,7861
22
22
  strawberry/channels/handlers/graphql_transport_ws_handler.py,sha256=jMWmZ4Haoo3bf_bcM4ZheAjkreuhZBhwMhEX6GZ0Ue4,1995
23
23
  strawberry/channels/handlers/graphql_ws_handler.py,sha256=2W_KpXMmC-LbFLBMMFNarFIMyEBipmIOlQpfnfsyLbE,2538
24
- strawberry/channels/handlers/http_handler.py,sha256=rQEdmKnsYE5PTjG1t8AWA8mCC1FsIsvLZnFRiUSHUuc,10959
24
+ strawberry/channels/handlers/http_handler.py,sha256=k4-qer3trApTv8VXEvAc2ub6QATKcOxPBaIezNqhjDQ,11142
25
25
  strawberry/channels/handlers/ws_handler.py,sha256=rXWhLxDHSGJHYdCDMb-pckxka-rf4VZqaNSzkagTa6w,4693
26
26
  strawberry/channels/router.py,sha256=DKIbl4zuRBhfvViUVpyu0Rf_WRT41E6uZC-Yic9Ltvo,2024
27
27
  strawberry/channels/testing.py,sha256=f_PcBngLJXRmLftpr0IEoXiJzChsDPaB_ax7CK3oHmQ,6152
@@ -57,7 +57,7 @@ strawberry/django/apps.py,sha256=ZWw3Mzv1Cgy0T9xT8Jr2_dkCTZjT5WQABb34iqnu5pc,135
57
57
  strawberry/django/context.py,sha256=XL85jDGAVnb2pwgm5uRUvIXwlGia3i-8ZVfKihf0T24,655
58
58
  strawberry/django/test/__init__.py,sha256=4xxdUZtIISSOwjrcnmox7AvT4WWjowCm5bUuPdQneMg,71
59
59
  strawberry/django/test/client.py,sha256=6dorWECd0wdn8fu3dabE-dfGK3uza58mGrdJ-xPct-w,626
60
- strawberry/django/views.py,sha256=31D1xgtewURv2X5MuAtnsOjrxNhuMNrjYRlhAo_uwT8,9919
60
+ strawberry/django/views.py,sha256=_qN_DhI7WQaNboBe86zIoZ1UuSwkjJqweNmtim3wpcA,9835
61
61
  strawberry/exceptions/__init__.py,sha256=DgdOJUs2xXHWcakr4tN6iIogltPi0MNnpu6MM6K0p5k,6347
62
62
  strawberry/exceptions/conflicting_arguments.py,sha256=68f6kMSXdjuEjZkoe8o2I9PSIjwTS1kXsSGaQBPk_hI,1587
63
63
  strawberry/exceptions/duplicated_type_name.py,sha256=-FG5qG_Mvkd7ROdOxCB9bijf8QR6Olryf07mbAFC0-U,2210
@@ -123,7 +123,7 @@ strawberry/fastapi/context.py,sha256=07991DShQoYMBVyQl9Mh5xvXQSNQI2RXT2ZQ5fWiga4
123
123
  strawberry/fastapi/handlers/__init__.py,sha256=TziBHyibYBOGiidjpCkjNThYbVY7K_nt0hnRLVHVh3I,241
124
124
  strawberry/fastapi/handlers/graphql_transport_ws_handler.py,sha256=5ivH7DJup0ZyGawAcj-n9VE_exBTje9Hou0_GIZCyD4,591
125
125
  strawberry/fastapi/handlers/graphql_ws_handler.py,sha256=OTloVUvEgXDpqjOlBAT1FnaNWRAglQgAt613YH06roc,537
126
- strawberry/fastapi/router.py,sha256=5_IJZCO5pAH-F5ZsXxy2uwzQhL7HU24iRkZ20poVp60,13010
126
+ strawberry/fastapi/router.py,sha256=JETjyeSnKarpQPEKKAmVKlDNpWVJKLGlKJywsAgfdNs,12938
127
127
  strawberry/federation/__init__.py,sha256=FeUxLiBVuk9TKBmJJi51SeUaI8c80rS8hbl9No-hjII,535
128
128
  strawberry/federation/argument.py,sha256=2m_wgp7uFQDimTDDCBBqSoWeTop4MD1-KjjYrumEJIw,833
129
129
  strawberry/federation/enum.py,sha256=1rx50FiSMS-NjEFErhRSYB5no8TPsGMA_cH7hVbxAFI,3015
@@ -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=lRHuYeDUvz7bpLsvBvTYPOXwD_uMz2LO78QaqGVSvEQ,1546
147
- strawberry/http/async_base_view.py,sha256=akBjdylFeVCO-tSH_1P8DMV497sLNN65_oBWMnLjmf4,10838
147
+ strawberry/http/async_base_view.py,sha256=zie22GChg-RZJnE-G8FOLYKY2EKi53ALhK7tEo3l3Bs,11141
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
@@ -154,7 +154,7 @@ strawberry/http/temporal_response.py,sha256=QrGYSg7Apu7Mh-X_uPKDZby-UicXw2J_ywxa
154
154
  strawberry/http/types.py,sha256=cAuaiUuvaMI_XhZ2Ey6Ej23WyQKqMGFxzzpVHDjVazY,371
155
155
  strawberry/http/typevars.py,sha256=flx5KPWnTwYju7VwRSVhMmx15Rl1pQT1K57_GnK72Hg,282
156
156
  strawberry/litestar/__init__.py,sha256=zsXzg-mglCGUVO9iNXLm-yadoDSCK7k-zuyRqyvAh1w,237
157
- strawberry/litestar/controller.py,sha256=gMQAhJH-knZHXBybuWmr-aoGQptwYMEyE6G-D4o5ggw,14156
157
+ strawberry/litestar/controller.py,sha256=448P5HTt5ZwxNhuhpgWuhX1-YpZl1UzSxvDJHQquw9c,14062
158
158
  strawberry/litestar/handlers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
159
159
  strawberry/litestar/handlers/graphql_transport_ws_handler.py,sha256=rDE-I02_fCov4FfpdBJBE2Xt-4FSNU8xJuQ6xedMF6E,2050
160
160
  strawberry/litestar/handlers/graphql_ws_handler.py,sha256=iCi2htoSgfk5H59gnw0tMwe9NxodqcaaxSsZ6TkQWYU,2283
@@ -165,7 +165,7 @@ strawberry/printer/ast_from_value.py,sha256=LgM5g2qvBOnAIf9znbiMEcRX0PGSQohR3Vr3
165
165
  strawberry/printer/printer.py,sha256=GntTBivg3fb_zPM41Q8DtWMiRmkmM9xwTF-aFWvnqTg,17524
166
166
  strawberry/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
167
167
  strawberry/quart/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
168
- strawberry/quart/views.py,sha256=GddrI25IFC43kZAjcmK0PfbPhdQlJAYFhA4-66Q77E0,3974
168
+ strawberry/quart/views.py,sha256=LTLByEaPgNGU9KSow9IECbH9uB_siGK0j13Wm9jElKY,3886
169
169
  strawberry/relay/__init__.py,sha256=Vi4btvA_g6Cj9Tk_F9GCSegapIf2WqkOWV8y3P0cTCs,553
170
170
  strawberry/relay/exceptions.py,sha256=KZSRJYlfutrAQALtBPnzJHRIMK6GZSnKAT_H4wIzGcI,4035
171
171
  strawberry/relay/fields.py,sha256=qrpDxDQ_bdzDUKtd8gxo9P3Oermxbux3yjFvHvHC1Ho,16927
@@ -175,7 +175,7 @@ strawberry/resolvers.py,sha256=Vdidc3YFc4-olSQZD_xQ1icyAFbyzqs_8I3eSpMFlA4,260
175
175
  strawberry/sanic/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
176
176
  strawberry/sanic/context.py,sha256=qN7I9K_qIqgdbG_FbDl8XMb9aM1PyjIxSo8IAg2Uq8o,844
177
177
  strawberry/sanic/utils.py,sha256=r-tCX0JzELAdupF7fFy65JWAxj6pABSntNbGNaGZT8o,1080
178
- strawberry/sanic/views.py,sha256=q73BNJ_PVmnM-7_z3UwwPPpGQpQc_MQX2yI1l64__Nw,6552
178
+ strawberry/sanic/views.py,sha256=Y1zSmaFfcP7ZyOoBXjPTGc2PWKSvv8Lo5m_GA1EyEPI,6465
179
179
  strawberry/scalars.py,sha256=c3y8EOmX-KUxSgRqk1TNercMA6_rgBHhQPp0z3C2zBU,2240
180
180
  strawberry/schema/__init__.py,sha256=u1QCyDVQExUVDA20kyosKPz3TS5HMCN2NrXclhiFAL4,92
181
181
  strawberry/schema/base.py,sha256=y6nhXZ_-Oid79rS5uLLYn_azlZ3PzTOLGcO_7W5lovo,3742
@@ -244,8 +244,8 @@ strawberry/utils/logging.py,sha256=U1cseHGquN09YFhFmRkiphfASKCyK0HUZREImPgVb0c,7
244
244
  strawberry/utils/operation.py,sha256=SSXxN-vMqdHO6W2OZtip-1z7y4_A-eTVFdhDvhKeLCk,1193
245
245
  strawberry/utils/str_converters.py,sha256=KGd7QH90RevaJjH6SQEkiVVsb8KuhJr_wv5AsI7UzQk,897
246
246
  strawberry/utils/typing.py,sha256=tUHHX2YTGX417EEQHB6j0B8-p-fg31ZI8csc9SUoq2I,14260
247
- strawberry_graphql-0.239.0.dist-info/LICENSE,sha256=m-XnIVUKqlG_AWnfi9NReh9JfKhYOB-gJfKE45WM1W8,1072
248
- strawberry_graphql-0.239.0.dist-info/METADATA,sha256=UFNRnyQUMG9QbrayCz1BSLfI5iHibPp8OtEDJ4jnLfE,7707
249
- strawberry_graphql-0.239.0.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
250
- strawberry_graphql-0.239.0.dist-info/entry_points.txt,sha256=Nk7-aT3_uEwCgyqtHESV9H6Mc31cK-VAvhnQNTzTb4k,49
251
- strawberry_graphql-0.239.0.dist-info/RECORD,,
247
+ strawberry_graphql-0.239.1.dist-info/LICENSE,sha256=m-XnIVUKqlG_AWnfi9NReh9JfKhYOB-gJfKE45WM1W8,1072
248
+ strawberry_graphql-0.239.1.dist-info/METADATA,sha256=cTmzQZAJ8gaSmrjhMUVj4xKC0ThHITL6fDzttqyZLKc,7707
249
+ strawberry_graphql-0.239.1.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
250
+ strawberry_graphql-0.239.1.dist-info/entry_points.txt,sha256=Nk7-aT3_uEwCgyqtHESV9H6Mc31cK-VAvhnQNTzTb4k,49
251
+ strawberry_graphql-0.239.1.dist-info/RECORD,,