workers-runtime-sdk 1.6.6__tar.gz → 1.6.8__tar.gz
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.
- {workers_runtime_sdk-1.6.6 → workers_runtime_sdk-1.6.8}/AGENTS.md +1 -1
- {workers_runtime_sdk-1.6.6 → workers_runtime_sdk-1.6.8}/CHANGELOG.md +18 -0
- {workers_runtime_sdk-1.6.6 → workers_runtime_sdk-1.6.8}/PKG-INFO +1 -1
- {workers_runtime_sdk-1.6.6 → workers_runtime_sdk-1.6.8}/pyproject.toml +9 -1
- {workers_runtime_sdk-1.6.6 → workers_runtime_sdk-1.6.8}/src/_workers_sdk_entropy_import_context.py +4 -8
- {workers_runtime_sdk-1.6.6 → workers_runtime_sdk-1.6.8}/src/workers/wsgi.py +9 -1
- workers_runtime_sdk-1.6.8/tests/bindings-test/public/data.json +1 -0
- workers_runtime_sdk-1.6.8/tests/bindings-test/public/hello.txt +1 -0
- workers_runtime_sdk-1.6.8/tests/bindings-test/pyproject.toml +5 -0
- workers_runtime_sdk-1.6.8/tests/bindings-test/src/conftest.py +10 -0
- workers_runtime_sdk-1.6.8/tests/bindings-test/src/test_analytics_engine.py +24 -0
- workers_runtime_sdk-1.6.8/tests/bindings-test/src/test_assets.py +35 -0
- workers_runtime_sdk-1.6.8/tests/bindings-test/src/test_d1.py +498 -0
- workers_runtime_sdk-1.6.8/tests/bindings-test/src/test_do.py +224 -0
- workers_runtime_sdk-1.6.8/tests/bindings-test/src/test_images.py +41 -0
- workers_runtime_sdk-1.6.8/tests/bindings-test/src/test_kv.py +320 -0
- workers_runtime_sdk-1.6.8/tests/bindings-test/src/test_mtls.py +15 -0
- workers_runtime_sdk-1.6.8/tests/bindings-test/src/test_queue.py +125 -0
- workers_runtime_sdk-1.6.8/tests/bindings-test/src/test_r2.py +393 -0
- workers_runtime_sdk-1.6.8/tests/bindings-test/src/test_ratelimit.py +14 -0
- workers_runtime_sdk-1.6.8/tests/bindings-test/src/test_vectorize.py +11 -0
- workers_runtime_sdk-1.6.8/tests/bindings-test/src/test_version_metadata.py +17 -0
- workers_runtime_sdk-1.6.8/tests/bindings-test/src/test_workflow.py +215 -0
- workers_runtime_sdk-1.6.8/tests/bindings-test/src/worker.py +186 -0
- workers_runtime_sdk-1.6.8/tests/bindings-test/src/worker_durable_object.py +260 -0
- workers_runtime_sdk-1.6.8/tests/bindings-test/src/worker_workflow.py +130 -0
- workers_runtime_sdk-1.6.8/tests/bindings-test/wrangler.jsonc +65 -0
- workers_runtime_sdk-1.6.8/tests/conftest.py +267 -0
- workers_runtime_sdk-1.6.8/tests/test_bindings.py +27 -0
- workers_runtime_sdk-1.6.8/tests/test_fastapi.py +44 -0
- workers_runtime_sdk-1.6.8/tests/test_in_workerd.py +151 -0
- workers_runtime_sdk-1.6.8/tests/test_web_frameworks.py +41 -0
- workers_runtime_sdk-1.6.8/tests/web-frameworks-test/django-async/pyproject.toml +11 -0
- workers_runtime_sdk-1.6.8/tests/web-frameworks-test/django-async/src/_client.py +92 -0
- workers_runtime_sdk-1.6.8/tests/web-frameworks-test/django-async/src/conftest.py +10 -0
- workers_runtime_sdk-1.6.8/tests/web-frameworks-test/django-async/src/django_app/__init__.py +0 -0
- workers_runtime_sdk-1.6.8/tests/web-frameworks-test/django-async/src/django_app/api_urls.py +13 -0
- workers_runtime_sdk-1.6.8/tests/web-frameworks-test/django-async/src/django_app/auth_backend.py +77 -0
- workers_runtime_sdk-1.6.8/tests/web-frameworks-test/django-async/src/django_app/drf_auth.py +24 -0
- workers_runtime_sdk-1.6.8/tests/web-frameworks-test/django-async/src/django_app/drf_serializers.py +36 -0
- workers_runtime_sdk-1.6.8/tests/web-frameworks-test/django-async/src/django_app/drf_throttling.py +12 -0
- workers_runtime_sdk-1.6.8/tests/web-frameworks-test/django-async/src/django_app/drf_views.py +134 -0
- workers_runtime_sdk-1.6.8/tests/web-frameworks-test/django-async/src/django_app/forms.py +39 -0
- workers_runtime_sdk-1.6.8/tests/web-frameworks-test/django-async/src/django_app/middleware.py +17 -0
- workers_runtime_sdk-1.6.8/tests/web-frameworks-test/django-async/src/django_app/templatetags/__init__.py +0 -0
- workers_runtime_sdk-1.6.8/tests/web-frameworks-test/django-async/src/django_app/templatetags/custom_tags.py +13 -0
- workers_runtime_sdk-1.6.8/tests/web-frameworks-test/django-async/src/django_app/urls.py +67 -0
- workers_runtime_sdk-1.6.8/tests/web-frameworks-test/django-async/src/django_app/views.py +363 -0
- workers_runtime_sdk-1.6.8/tests/web-frameworks-test/django-async/src/templates/base.html +5 -0
- workers_runtime_sdk-1.6.8/tests/web-frameworks-test/django-async/src/templates/context_test.html +6 -0
- workers_runtime_sdk-1.6.8/tests/web-frameworks-test/django-async/src/templates/csrf_form.html +1 -0
- workers_runtime_sdk-1.6.8/tests/web-frameworks-test/django-async/src/templates/hello.html +3 -0
- workers_runtime_sdk-1.6.8/tests/web-frameworks-test/django-async/src/test_async_utilities.py +19 -0
- workers_runtime_sdk-1.6.8/tests/web-frameworks-test/django-async/src/test_auth.py +86 -0
- workers_runtime_sdk-1.6.8/tests/web-frameworks-test/django-async/src/test_caching.py +62 -0
- workers_runtime_sdk-1.6.8/tests/web-frameworks-test/django-async/src/test_cors.py +46 -0
- workers_runtime_sdk-1.6.8/tests/web-frameworks-test/django-async/src/test_csrf.py +69 -0
- workers_runtime_sdk-1.6.8/tests/web-frameworks-test/django-async/src/test_drf_auth_permissions.py +47 -0
- workers_runtime_sdk-1.6.8/tests/web-frameworks-test/django-async/src/test_drf_content_negotiation.py +41 -0
- workers_runtime_sdk-1.6.8/tests/web-frameworks-test/django-async/src/test_drf_serializers.py +68 -0
- workers_runtime_sdk-1.6.8/tests/web-frameworks-test/django-async/src/test_drf_throttling.py +16 -0
- workers_runtime_sdk-1.6.8/tests/web-frameworks-test/django-async/src/test_drf_versioning.py +25 -0
- workers_runtime_sdk-1.6.8/tests/web-frameworks-test/django-async/src/test_drf_views.py +73 -0
- workers_runtime_sdk-1.6.8/tests/web-frameworks-test/django-async/src/test_error_handling.py +32 -0
- workers_runtime_sdk-1.6.8/tests/web-frameworks-test/django-async/src/test_file_uploads.py +57 -0
- workers_runtime_sdk-1.6.8/tests/web-frameworks-test/django-async/src/test_forms.py +50 -0
- workers_runtime_sdk-1.6.8/tests/web-frameworks-test/django-async/src/test_middleware.py +27 -0
- workers_runtime_sdk-1.6.8/tests/web-frameworks-test/django-async/src/test_pagination.py +36 -0
- workers_runtime_sdk-1.6.8/tests/web-frameworks-test/django-async/src/test_request_response.py +98 -0
- workers_runtime_sdk-1.6.8/tests/web-frameworks-test/django-async/src/test_sessions.py +95 -0
- workers_runtime_sdk-1.6.8/tests/web-frameworks-test/django-async/src/test_signals.py +33 -0
- workers_runtime_sdk-1.6.8/tests/web-frameworks-test/django-async/src/test_streaming.py +22 -0
- workers_runtime_sdk-1.6.8/tests/web-frameworks-test/django-async/src/test_templates.py +34 -0
- workers_runtime_sdk-1.6.8/tests/web-frameworks-test/django-async/src/test_url_routing.py +69 -0
- workers_runtime_sdk-1.6.8/tests/web-frameworks-test/django-async/src/test_views_basic.py +71 -0
- workers_runtime_sdk-1.6.8/tests/web-frameworks-test/django-async/src/worker.py +206 -0
- workers_runtime_sdk-1.6.8/tests/web-frameworks-test/django-async/wrangler.jsonc +6 -0
- workers_runtime_sdk-1.6.8/tests/web-frameworks-test/fastapi-tests/public/data.json +1 -0
- workers_runtime_sdk-1.6.8/tests/web-frameworks-test/fastapi-tests/public/index.html +7 -0
- workers_runtime_sdk-1.6.8/tests/web-frameworks-test/fastapi-tests/public/style.css +5 -0
- workers_runtime_sdk-1.6.8/tests/web-frameworks-test/fastapi-tests/pyproject.toml +9 -0
- workers_runtime_sdk-1.6.8/tests/web-frameworks-test/fastapi-tests/src/_client.py +26 -0
- workers_runtime_sdk-1.6.8/tests/web-frameworks-test/fastapi-tests/src/conftest.py +10 -0
- workers_runtime_sdk-1.6.8/tests/web-frameworks-test/fastapi-tests/src/test_assets.py +65 -0
- workers_runtime_sdk-1.6.8/tests/web-frameworks-test/fastapi-tests/src/worker.py +143 -0
- workers_runtime_sdk-1.6.8/tests/web-frameworks-test/fastapi-tests/wrangler.jsonc +11 -0
- workers_runtime_sdk-1.6.8/tests/workerd-test/asgi/asgi.wd-test +19 -0
- workers_runtime_sdk-1.6.8/tests/workerd-test/asgi/pyproject.toml +5 -0
- workers_runtime_sdk-1.6.8/tests/workerd-test/asgi/tests/test_asgi.py +401 -0
- workers_runtime_sdk-1.6.8/tests/workerd-test/asgi/worker.py +240 -0
- workers_runtime_sdk-1.6.8/tests/workerd-test/asgi/wrangler.jsonc +5 -0
- workers_runtime_sdk-1.6.8/tests/workerd-test/asgi-ws-disconnect/asgi-ws-disconnect.wd-test +19 -0
- workers_runtime_sdk-1.6.8/tests/workerd-test/asgi-ws-disconnect/pyproject.toml +5 -0
- workers_runtime_sdk-1.6.8/tests/workerd-test/asgi-ws-disconnect/tests/test_ws_disconnect.py +72 -0
- workers_runtime_sdk-1.6.8/tests/workerd-test/asgi-ws-disconnect/worker.py +70 -0
- workers_runtime_sdk-1.6.8/tests/workerd-test/asgi-ws-disconnect/wrangler.jsonc +5 -0
- workers_runtime_sdk-1.6.8/tests/workerd-test/durable-object/durable-object.wd-test +28 -0
- workers_runtime_sdk-1.6.8/tests/workerd-test/durable-object/pyproject.toml +5 -0
- workers_runtime_sdk-1.6.8/tests/workerd-test/durable-object/worker.py +144 -0
- workers_runtime_sdk-1.6.8/tests/workerd-test/durable-object/wrangler.jsonc +5 -0
- workers_runtime_sdk-1.6.8/tests/workerd-test/durable-object-abort/durable-object-abort.wd-test +27 -0
- workers_runtime_sdk-1.6.8/tests/workerd-test/durable-object-abort/pyproject.toml +5 -0
- workers_runtime_sdk-1.6.8/tests/workerd-test/durable-object-abort/worker.py +57 -0
- workers_runtime_sdk-1.6.8/tests/workerd-test/durable-object-abort/wrangler.jsonc +5 -0
- workers_runtime_sdk-1.6.8/tests/workerd-test/durable-object-inheritance/durable-object-inheritance.wd-test +40 -0
- workers_runtime_sdk-1.6.8/tests/workerd-test/durable-object-inheritance/pyproject.toml +5 -0
- workers_runtime_sdk-1.6.8/tests/workerd-test/durable-object-inheritance/worker.py +115 -0
- workers_runtime_sdk-1.6.8/tests/workerd-test/durable-object-inheritance/wrangler.jsonc +5 -0
- workers_runtime_sdk-1.6.8/tests/workerd-test/durable-object-websocket/durable-object-websocket.wd-test +39 -0
- workers_runtime_sdk-1.6.8/tests/workerd-test/durable-object-websocket/pyproject.toml +5 -0
- workers_runtime_sdk-1.6.8/tests/workerd-test/durable-object-websocket/tester.js +27 -0
- workers_runtime_sdk-1.6.8/tests/workerd-test/durable-object-websocket/worker.py +43 -0
- workers_runtime_sdk-1.6.8/tests/workerd-test/durable-object-websocket/wrangler.jsonc +5 -0
- workers_runtime_sdk-1.6.8/tests/workerd-test/entropy-patches/entropy-patches.wd-test +18 -0
- workers_runtime_sdk-1.6.8/tests/workerd-test/entropy-patches/pyproject.toml +18 -0
- workers_runtime_sdk-1.6.8/tests/workerd-test/entropy-patches/tests/test_aiohttp_websocket.py +7 -0
- workers_runtime_sdk-1.6.8/tests/workerd-test/entropy-patches/tests/test_langsmith.py +8 -0
- workers_runtime_sdk-1.6.8/tests/workerd-test/entropy-patches/tests/test_numpy.py +9 -0
- workers_runtime_sdk-1.6.8/tests/workerd-test/entropy-patches/tests/test_pydantic.py +8 -0
- workers_runtime_sdk-1.6.8/tests/workerd-test/entropy-patches/tests/test_rust_packages.py +10 -0
- workers_runtime_sdk-1.6.8/tests/workerd-test/entropy-patches/tests/test_ssl_avoidance.py +9 -0
- workers_runtime_sdk-1.6.8/tests/workerd-test/entropy-patches/worker.py +27 -0
- workers_runtime_sdk-1.6.8/tests/workerd-test/entropy-patches/wrangler.jsonc +5 -0
- workers_runtime_sdk-1.6.8/tests/workerd-test/python-rpc/pyproject.toml +5 -0
- workers_runtime_sdk-1.6.8/tests/workerd-test/python-rpc/python-rpc.wd-test +34 -0
- workers_runtime_sdk-1.6.8/tests/workerd-test/python-rpc/worker.js +101 -0
- workers_runtime_sdk-1.6.8/tests/workerd-test/python-rpc/worker.py +384 -0
- workers_runtime_sdk-1.6.8/tests/workerd-test/python-rpc/wrangler.jsonc +5 -0
- workers_runtime_sdk-1.6.8/tests/workerd-test/sdk/pyproject.toml +5 -0
- workers_runtime_sdk-1.6.8/tests/workerd-test/sdk/sdk.wd-test +42 -0
- workers_runtime_sdk-1.6.8/tests/workerd-test/sdk/server.py +35 -0
- workers_runtime_sdk-1.6.8/tests/workerd-test/sdk/tests/test_sdk.py +608 -0
- workers_runtime_sdk-1.6.8/tests/workerd-test/sdk/worker.py +71 -0
- workers_runtime_sdk-1.6.8/tests/workerd-test/sdk/wrangler.jsonc +5 -0
- workers_runtime_sdk-1.6.8/tests/workerd-test/wsgi/pyproject.toml +5 -0
- workers_runtime_sdk-1.6.8/tests/workerd-test/wsgi/worker.py +205 -0
- workers_runtime_sdk-1.6.8/tests/workerd-test/wsgi/wrangler.jsonc +5 -0
- workers_runtime_sdk-1.6.8/tests/workerd-test/wsgi/wsgi.wd-test +19 -0
- {workers_runtime_sdk-1.6.6 → workers_runtime_sdk-1.6.8}/uv.lock +119 -1
- {workers_runtime_sdk-1.6.6 → workers_runtime_sdk-1.6.8}/.gitignore +0 -0
- {workers_runtime_sdk-1.6.6 → workers_runtime_sdk-1.6.8}/README.md +0 -0
- {workers_runtime_sdk-1.6.6 → workers_runtime_sdk-1.6.8}/src/_cloudflare_compat_flags.pyi +0 -0
- {workers_runtime_sdk-1.6.6 → workers_runtime_sdk-1.6.8}/src/_pyodide_entrypoint_helper.pyi +0 -0
- {workers_runtime_sdk-1.6.6 → workers_runtime_sdk-1.6.8}/src/_workers_sdk_entropy_import_context.pth +0 -0
- {workers_runtime_sdk-1.6.6 → workers_runtime_sdk-1.6.8}/src/_workers_sdk_entropy_import_context_loader.py +0 -0
- {workers_runtime_sdk-1.6.6 → workers_runtime_sdk-1.6.8}/src/asgi.py +0 -0
- {workers_runtime_sdk-1.6.6 → workers_runtime_sdk-1.6.8}/src/workers/__init__.py +0 -0
- {workers_runtime_sdk-1.6.6 → workers_runtime_sdk-1.6.8}/src/workers/blob.py +0 -0
- {workers_runtime_sdk-1.6.6 → workers_runtime_sdk-1.6.8}/src/workers/entrypoints.py +0 -0
- {workers_runtime_sdk-1.6.6 → workers_runtime_sdk-1.6.8}/src/workers/fetch.py +0 -0
- {workers_runtime_sdk-1.6.6 → workers_runtime_sdk-1.6.8}/src/workers/formdata.py +0 -0
- {workers_runtime_sdk-1.6.6 → workers_runtime_sdk-1.6.8}/src/workers/py.typed +0 -0
- {workers_runtime_sdk-1.6.6 → workers_runtime_sdk-1.6.8}/src/workers/request.py +0 -0
- {workers_runtime_sdk-1.6.6 → workers_runtime_sdk-1.6.8}/src/workers/response.py +0 -0
- {workers_runtime_sdk-1.6.6 → workers_runtime_sdk-1.6.8}/src/workers/rpc.py +0 -0
- {workers_runtime_sdk-1.6.6 → workers_runtime_sdk-1.6.8}/src/workers/types.py +0 -0
- {workers_runtime_sdk-1.6.6 → workers_runtime_sdk-1.6.8}/src/workers/utils.py +0 -0
- {workers_runtime_sdk-1.6.6 → workers_runtime_sdk-1.6.8}/src/workers/workflows.py +0 -0
|
@@ -2,6 +2,24 @@
|
|
|
2
2
|
|
|
3
3
|
<!-- version list -->
|
|
4
4
|
|
|
5
|
+
## v1.6.8 (2026-08-05)
|
|
6
|
+
|
|
7
|
+
### Bug Fixes
|
|
8
|
+
|
|
9
|
+
- **runtime-sdk**: Do not include HTTP body for null body status codes
|
|
10
|
+
([#162](https://github.com/cloudflare/workers-py/pull/162),
|
|
11
|
+
[`693d594`](https://github.com/cloudflare/workers-py/commit/693d5945fd6531beb0d9d2fd3c97bf7ee2c8f1f3))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## v1.6.7 (2026-08-05)
|
|
15
|
+
|
|
16
|
+
### Bug Fixes
|
|
17
|
+
|
|
18
|
+
- Fix entropy patch for newer pydantic versions
|
|
19
|
+
([#153](https://github.com/cloudflare/workers-py/pull/153),
|
|
20
|
+
[`81a4b6b`](https://github.com/cloudflare/workers-py/commit/81a4b6bad37373e0b448dd2dbedbf6cec0f47b8c))
|
|
21
|
+
|
|
22
|
+
|
|
5
23
|
## v1.6.6 (2026-08-03)
|
|
6
24
|
|
|
7
25
|
### Bug Fixes
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: workers-runtime-sdk
|
|
3
|
-
Version: 1.6.
|
|
3
|
+
Version: 1.6.8
|
|
4
4
|
Summary: Python SDK for Cloudflare Workers
|
|
5
5
|
Project-URL: Homepage, https://github.com/cloudflare/workers-py
|
|
6
6
|
Project-URL: Bug Tracker, https://github.com/cloudflare/workers-py/issues
|
|
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "workers-runtime-sdk"
|
|
7
|
-
version = "1.6.
|
|
7
|
+
version = "1.6.8"
|
|
8
8
|
description = "Python SDK for Cloudflare Workers"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.11"
|
|
@@ -20,6 +20,7 @@ dev = [
|
|
|
20
20
|
"pytest>=7.0.0",
|
|
21
21
|
"ruff>=0.1.0",
|
|
22
22
|
"mypy>=1.0.0",
|
|
23
|
+
"requests>=2.28.0",
|
|
23
24
|
]
|
|
24
25
|
|
|
25
26
|
[project.urls]
|
|
@@ -56,6 +57,13 @@ lint.ignore = [
|
|
|
56
57
|
"UP038", # Use X | Y instead of (X, Y)
|
|
57
58
|
]
|
|
58
59
|
lint.flake8-comprehensions.allow-dict-calls-with-keyword-arguments = true
|
|
60
|
+
lint.per-file-ignores."tests/**" = ["PLR2004", "PLR0913"]
|
|
61
|
+
lint.per-file-ignores."tests/workerd-test/**" = ["C901", "PLR0911", "PLR0912", "PLR2004", "PLW0603"]
|
|
62
|
+
lint.per-file-ignores."tests/bindings-test/**" = ["C901", "PLR0911", "PLR0912", "PLR2004", "PLW0603"]
|
|
63
|
+
lint.per-file-ignores."tests/web-frameworks-test/**" = ["C901", "PLR0911", "PLR0912", "PLR2004", "PLW0603"]
|
|
64
|
+
|
|
65
|
+
[tool.pytest.ini_options]
|
|
66
|
+
addopts = ["--ignore=tests/workerd-test", "--ignore=tests/bindings-test", "--ignore=tests/web-frameworks-test"]
|
|
59
67
|
|
|
60
68
|
[tool.mypy]
|
|
61
69
|
packages = ["workers_runtime_sdk"]
|
{workers_runtime_sdk-1.6.6 → workers_runtime_sdk-1.6.8}/src/_workers_sdk_entropy_import_context.py
RENAMED
|
@@ -93,14 +93,10 @@ def pydantic_core_context(module):
|
|
|
93
93
|
with allow_bad_entropy_calls(1):
|
|
94
94
|
yield
|
|
95
95
|
finally:
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
# but only after making the needed entropy call.
|
|
101
|
-
module.validate_core_schema(None)
|
|
102
|
-
except module.SchemaError:
|
|
103
|
-
pass
|
|
96
|
+
# Build a tiny validator instead so any lazy hash-map seeds are initialized
|
|
97
|
+
# before the snapshot is captured.
|
|
98
|
+
with allow_bad_entropy_calls(1):
|
|
99
|
+
module.SchemaValidator({"type": "any"})
|
|
104
100
|
|
|
105
101
|
|
|
106
102
|
@register_exec_patch("aiohttp.http_websocket")
|
|
@@ -10,6 +10,7 @@ import js
|
|
|
10
10
|
from workers import Context, Request
|
|
11
11
|
|
|
12
12
|
logger = logging.getLogger("wsgi")
|
|
13
|
+
NULL_BODY_STATUSES = frozenset({101, 103, 204, 205, 304})
|
|
13
14
|
|
|
14
15
|
|
|
15
16
|
def _wsgi_native_string(value: str) -> str:
|
|
@@ -230,7 +231,8 @@ def _make_streaming_response(
|
|
|
230
231
|
|
|
231
232
|
# WSGI status is e.g. "200 OK"; split into code + reason phrase.
|
|
232
233
|
code_str, _, reason = status.partition(" ")
|
|
233
|
-
|
|
234
|
+
code = int(code_str)
|
|
235
|
+
options: dict[str, Any] = {"status": code}
|
|
234
236
|
if reason:
|
|
235
237
|
options["statusText"] = reason
|
|
236
238
|
|
|
@@ -240,6 +242,12 @@ def _make_streaming_response(
|
|
|
240
242
|
js_headers.append(key, value)
|
|
241
243
|
options["headers"] = js_headers
|
|
242
244
|
|
|
245
|
+
if code in NULL_BODY_STATUSES:
|
|
246
|
+
# 101/103/204/205/304 must not carry a body per the Fetch spec.
|
|
247
|
+
# https://fetch.spec.whatwg.org/#null-body-status
|
|
248
|
+
on_close()
|
|
249
|
+
return Response.new(None, **options)
|
|
250
|
+
|
|
243
251
|
proxies: list[Any] = []
|
|
244
252
|
done = False
|
|
245
253
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"key": "value", "number": 42}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
hello from static assets
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import pytest
|
|
2
|
+
|
|
3
|
+
from workers.rpc import _BindingWrapper
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
@pytest.mark.asyncio
|
|
7
|
+
async def test_is_wrapped(env):
|
|
8
|
+
assert isinstance(env.ANALYTICS, _BindingWrapper)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
@pytest.mark.asyncio
|
|
12
|
+
async def test_write_data_point_blobs_and_doubles(env):
|
|
13
|
+
env.ANALYTICS.writeDataPoint(
|
|
14
|
+
{
|
|
15
|
+
"blobs": ["blob1", "blob2"],
|
|
16
|
+
"doubles": [1.0, 2.5],
|
|
17
|
+
"indexes": ["idx"],
|
|
18
|
+
}
|
|
19
|
+
)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
@pytest.mark.asyncio
|
|
23
|
+
async def test_write_data_point_empty(env):
|
|
24
|
+
env.ANALYTICS.writeDataPoint({})
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import pytest
|
|
2
|
+
|
|
3
|
+
from workers.rpc import _FetcherWrapper
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
@pytest.mark.asyncio
|
|
7
|
+
async def test_is_fetcher_wrapper(env):
|
|
8
|
+
assert isinstance(env.ASSETS, _FetcherWrapper)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
@pytest.mark.asyncio
|
|
12
|
+
async def test_fetch_text_file(env):
|
|
13
|
+
resp = await env.ASSETS.fetch("https://assets.local/hello.txt")
|
|
14
|
+
text = await resp.text()
|
|
15
|
+
assert text.strip() == "hello from static assets"
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
@pytest.mark.asyncio
|
|
19
|
+
async def test_fetch_json_file(env):
|
|
20
|
+
resp = await env.ASSETS.fetch("https://assets.local/data.json")
|
|
21
|
+
data = await resp.json()
|
|
22
|
+
assert data["key"] == "value"
|
|
23
|
+
assert data["number"] == 42
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
@pytest.mark.asyncio
|
|
27
|
+
async def test_fetch_returns_404_for_missing(env):
|
|
28
|
+
resp = await env.ASSETS.fetch("https://assets.local/nonexistent.txt")
|
|
29
|
+
assert resp.status == 404
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
@pytest.mark.asyncio
|
|
33
|
+
async def test_fetch_content_type(env):
|
|
34
|
+
resp = await env.ASSETS.fetch("https://assets.local/data.json")
|
|
35
|
+
assert "application/json" in resp.headers.get("content-type")
|