cadwyn 5.3.0__py3-none-any.whl → 5.3.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.
Potentially problematic release.
This version of cadwyn might be problematic. Click here for more details.
- cadwyn/structure/versions.py +7 -3
- {cadwyn-5.3.0.dist-info → cadwyn-5.3.1.dist-info}/METADATA +2 -2
- {cadwyn-5.3.0.dist-info → cadwyn-5.3.1.dist-info}/RECORD +6 -6
- {cadwyn-5.3.0.dist-info → cadwyn-5.3.1.dist-info}/WHEEL +0 -0
- {cadwyn-5.3.0.dist-info → cadwyn-5.3.1.dist-info}/entry_points.txt +0 -0
- {cadwyn-5.3.0.dist-info → cadwyn-5.3.1.dist-info}/licenses/LICENSE +0 -0
cadwyn/structure/versions.py
CHANGED
|
@@ -528,6 +528,8 @@ class VersionBundle:
|
|
|
528
528
|
status_code=raised_exception.status_code,
|
|
529
529
|
headers=raised_exception.headers,
|
|
530
530
|
)
|
|
531
|
+
if (raised_exception.headers or {}).get("content-length") is None: # pragma: no branch
|
|
532
|
+
del response_or_response_body.headers["content-length"]
|
|
531
533
|
api_version = self.api_version_var.get()
|
|
532
534
|
if api_version is None:
|
|
533
535
|
return response_or_response_body
|
|
@@ -579,6 +581,7 @@ class VersionBundle:
|
|
|
579
581
|
head_route.response_model,
|
|
580
582
|
head_route,
|
|
581
583
|
)
|
|
584
|
+
|
|
582
585
|
if isinstance(response_or_response_body, FastapiResponse):
|
|
583
586
|
# a webserver (uvicorn for instance) calculates the body at the endpoint level.
|
|
584
587
|
# if an endpoint returns no "body", its content-length will be set to 0
|
|
@@ -605,9 +608,10 @@ class VersionBundle:
|
|
|
605
608
|
indent=None,
|
|
606
609
|
separators=(",", ":"),
|
|
607
610
|
).encode("utf-8")
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
+
if response_info.headers.get("content-length") is not None:
|
|
612
|
+
# It makes sense to re-calculate content length because the previously calculated one
|
|
613
|
+
# might slightly differ. If it differs -- uvicorn will break.
|
|
614
|
+
response_info.headers["content-length"] = str(len(response_info._response.body))
|
|
611
615
|
|
|
612
616
|
if raised_exception is not None and response_info.status_code >= 400:
|
|
613
617
|
if isinstance(response_info.body, dict) and "detail" in response_info.body:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: cadwyn
|
|
3
|
-
Version: 5.3.
|
|
3
|
+
Version: 5.3.1
|
|
4
4
|
Summary: Production-ready community-driven modern Stripe-like API versioning in FastAPI
|
|
5
5
|
Project-URL: Source code, https://github.com/zmievsa/cadwyn
|
|
6
6
|
Project-URL: Documentation, https://docs.cadwyn.dev
|
|
@@ -71,7 +71,7 @@ Production-ready community-driven modern [Stripe-like](https://stripe.com/blog/a
|
|
|
71
71
|
|
|
72
72
|
## Who is this for?
|
|
73
73
|
|
|
74
|
-
Cadwyn allows you to
|
|
74
|
+
Cadwyn allows you to maintain the implementation just for your newest API version and get all the older versions generated automatically. You keep API versioning encapsulated in small and independent "version change" modules while your business logic stays simple and knows nothing about versioning.
|
|
75
75
|
|
|
76
76
|
Its [approach](https://docs.cadwyn.dev/theory/how_we_got_here/#ii-migration-based-response-building) will be useful if you want to:
|
|
77
77
|
|
|
@@ -23,9 +23,9 @@ cadwyn/structure/data.py,sha256=NWURVnP_84VI2ugp9ppo0Ofyve3pVYjymF9K82Jh-SA,7791
|
|
|
23
23
|
cadwyn/structure/endpoints.py,sha256=zUgzglNhBPnmWdJ03A8pFT4zPs_lj8nQ7c7Uo2d-ejU,6246
|
|
24
24
|
cadwyn/structure/enums.py,sha256=4FCc9aniLE3VuWAVIacrNP_FWxTIUm9JkeeHA_zZdwQ,1254
|
|
25
25
|
cadwyn/structure/schemas.py,sha256=O9yNw1OB0Qz-PvNB0FYlQm34gQsjyG2l9gg9x-RnJIY,10781
|
|
26
|
-
cadwyn/structure/versions.py,sha256=
|
|
27
|
-
cadwyn-5.3.
|
|
28
|
-
cadwyn-5.3.
|
|
29
|
-
cadwyn-5.3.
|
|
30
|
-
cadwyn-5.3.
|
|
31
|
-
cadwyn-5.3.
|
|
26
|
+
cadwyn/structure/versions.py,sha256=yOZ-x24Rb0itcZvQBe-92x9BiCLZK4cMqo0iX0DVN2k,34708
|
|
27
|
+
cadwyn-5.3.1.dist-info/METADATA,sha256=0iD1r46nUtL9fpEsyjb0d4dZn57JQ6qE-EUlSceSVYQ,4543
|
|
28
|
+
cadwyn-5.3.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
29
|
+
cadwyn-5.3.1.dist-info/entry_points.txt,sha256=mGX8wl-Xfhpr5M93SUmkykaqinUaYAvW9rtDSX54gx0,47
|
|
30
|
+
cadwyn-5.3.1.dist-info/licenses/LICENSE,sha256=KeCWewiDQYpmSnzF-p_0YpoWiyDcUPaCuG8OWQs4ig4,1072
|
|
31
|
+
cadwyn-5.3.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|