mockstack 0.11.0__tar.gz → 0.11.1__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.
- {mockstack-0.11.0 → mockstack-0.11.1}/PKG-INFO +1 -1
- {mockstack-0.11.0 → mockstack-0.11.1}/mockstack/strategies/proxyrules.py +5 -2
- {mockstack-0.11.0 → mockstack-0.11.1}/mockstack/tests/strategies/test_proxyrules.py +13 -10
- {mockstack-0.11.0 → mockstack-0.11.1}/mockstack.egg-info/PKG-INFO +1 -1
- {mockstack-0.11.0 → mockstack-0.11.1}/.dockerignore +0 -0
- {mockstack-0.11.0 → mockstack-0.11.1}/.env.example +0 -0
- {mockstack-0.11.0 → mockstack-0.11.1}/.github/ISSUE_TEMPLATE/bug_report.md +0 -0
- {mockstack-0.11.0 → mockstack-0.11.1}/.github/ISSUE_TEMPLATE/feature_request.md +0 -0
- {mockstack-0.11.0 → mockstack-0.11.1}/.github/workflows/ci.yml +0 -0
- {mockstack-0.11.0 → mockstack-0.11.1}/.github/workflows/publish-docs.yml +0 -0
- {mockstack-0.11.0 → mockstack-0.11.1}/.github/workflows/publish-to-dockerhub.yml +0 -0
- {mockstack-0.11.0 → mockstack-0.11.1}/.github/workflows/publish-to-pypi.yml +0 -0
- {mockstack-0.11.0 → mockstack-0.11.1}/.gitignore +0 -0
- {mockstack-0.11.0 → mockstack-0.11.1}/.pre-commit-config.yaml +0 -0
- {mockstack-0.11.0 → mockstack-0.11.1}/CODE_OF_CONDUCT.md +0 -0
- {mockstack-0.11.0 → mockstack-0.11.1}/CONTRIBUTING.md +0 -0
- {mockstack-0.11.0 → mockstack-0.11.1}/Dockerfile +0 -0
- {mockstack-0.11.0 → mockstack-0.11.1}/LICENSE +0 -0
- {mockstack-0.11.0 → mockstack-0.11.1}/README.md +0 -0
- {mockstack-0.11.0 → mockstack-0.11.1}/SECURITY.md +0 -0
- {mockstack-0.11.0 → mockstack-0.11.1}/docker-entrypoint.sh +0 -0
- {mockstack-0.11.0 → mockstack-0.11.1}/docs/assets/favicon.ico +0 -0
- {mockstack-0.11.0 → mockstack-0.11.1}/docs/assets/logo.png +0 -0
- {mockstack-0.11.0 → mockstack-0.11.1}/docs/assets/mockstack.png +0 -0
- {mockstack-0.11.0 → mockstack-0.11.1}/docs/configuration.md +0 -0
- {mockstack-0.11.0 → mockstack-0.11.1}/docs/ollama.md +0 -0
- {mockstack-0.11.0 → mockstack-0.11.1}/docs/strategies/base.md +0 -0
- {mockstack-0.11.0 → mockstack-0.11.1}/docs/strategies/filefixtures.md +0 -0
- {mockstack-0.11.0 → mockstack-0.11.1}/docs/strategies/proxyrules.md +0 -0
- {mockstack-0.11.0 → mockstack-0.11.1}/examples/filefixtures-with-templates/.env.example +0 -0
- {mockstack-0.11.0 → mockstack-0.11.1}/examples/filefixtures-with-templates/README.md +0 -0
- {mockstack-0.11.0 → mockstack-0.11.1}/examples/filefixtures-with-templates/templates/servicename-api-v1-items.j2 +0 -0
- {mockstack-0.11.0 → mockstack-0.11.1}/examples/filefixtures-with-templates/templates/servicename2-api-v2-user.533ec889-7c68-45c8-b21e-4a7e455d1234.j2 +0 -0
- {mockstack-0.11.0 → mockstack-0.11.1}/examples/llm/README.md +0 -0
- {mockstack-0.11.0 → mockstack-0.11.1}/examples/llm/mockstack-langchain-example.ipynb +0 -0
- {mockstack-0.11.0 → mockstack-0.11.1}/examples/llm/templates/ollama-openai-v1-chat-completions.j2 +0 -0
- {mockstack-0.11.0 → mockstack-0.11.1}/examples/llm/templates/openai-v1-chat-completions.j2 +0 -0
- {mockstack-0.11.0 → mockstack-0.11.1}/examples/llm/templates/openai-v1-deployments-gpt-4o-chat-completions.j2 +0 -0
- {mockstack-0.11.0 → mockstack-0.11.1}/examples/proxyrules-with-rules-file/.env.example +0 -0
- {mockstack-0.11.0 → mockstack-0.11.1}/examples/proxyrules-with-rules-file/README.md +0 -0
- {mockstack-0.11.0 → mockstack-0.11.1}/examples/proxyrules-with-rules-file/rules.yml +0 -0
- {mockstack-0.11.0 → mockstack-0.11.1}/mkdocs.yml +0 -0
- {mockstack-0.11.0 → mockstack-0.11.1}/mockstack/__init__.py +0 -0
- {mockstack-0.11.0 → mockstack-0.11.1}/mockstack/config.py +0 -0
- {mockstack-0.11.0 → mockstack-0.11.1}/mockstack/constants.py +0 -0
- {mockstack-0.11.0 → mockstack-0.11.1}/mockstack/display.py +0 -0
- {mockstack-0.11.0 → mockstack-0.11.1}/mockstack/exceptions.py +0 -0
- {mockstack-0.11.0 → mockstack-0.11.1}/mockstack/identifiers.py +0 -0
- {mockstack-0.11.0 → mockstack-0.11.1}/mockstack/intent.py +0 -0
- {mockstack-0.11.0 → mockstack-0.11.1}/mockstack/lifespan.py +0 -0
- {mockstack-0.11.0 → mockstack-0.11.1}/mockstack/llm/__init__.py +0 -0
- {mockstack-0.11.0 → mockstack-0.11.1}/mockstack/llm/ollama.py +0 -0
- {mockstack-0.11.0 → mockstack-0.11.1}/mockstack/main.py +0 -0
- {mockstack-0.11.0 → mockstack-0.11.1}/mockstack/middleware.py +0 -0
- {mockstack-0.11.0 → mockstack-0.11.1}/mockstack/routers/__init__.py +0 -0
- {mockstack-0.11.0 → mockstack-0.11.1}/mockstack/routers/catchall.py +0 -0
- {mockstack-0.11.0 → mockstack-0.11.1}/mockstack/routers/homepage.py +0 -0
- {mockstack-0.11.0 → mockstack-0.11.1}/mockstack/rules.py +0 -0
- {mockstack-0.11.0 → mockstack-0.11.1}/mockstack/strategies/__init__.py +0 -0
- {mockstack-0.11.0 → mockstack-0.11.1}/mockstack/strategies/base.py +0 -0
- {mockstack-0.11.0 → mockstack-0.11.1}/mockstack/strategies/create_mixin.py +0 -0
- {mockstack-0.11.0 → mockstack-0.11.1}/mockstack/strategies/factory.py +0 -0
- {mockstack-0.11.0 → mockstack-0.11.1}/mockstack/strategies/filefixtures.py +0 -0
- {mockstack-0.11.0 → mockstack-0.11.1}/mockstack/telemetry.py +0 -0
- {mockstack-0.11.0 → mockstack-0.11.1}/mockstack/templating.py +0 -0
- {mockstack-0.11.0 → mockstack-0.11.1}/mockstack/tests/__init__.py +0 -0
- {mockstack-0.11.0 → mockstack-0.11.1}/mockstack/tests/conftest.py +0 -0
- {mockstack-0.11.0 → mockstack-0.11.1}/mockstack/tests/fixtures/__init__.py +0 -0
- {mockstack-0.11.0 → mockstack-0.11.1}/mockstack/tests/fixtures/proxyrules.yml +0 -0
- {mockstack-0.11.0 → mockstack-0.11.1}/mockstack/tests/fixtures/templates/__init__.py +0 -0
- {mockstack-0.11.0 → mockstack-0.11.1}/mockstack/tests/fixtures/templates/example-template.j2 +0 -0
- {mockstack-0.11.0 → mockstack-0.11.1}/mockstack/tests/llm/__init__.py +0 -0
- {mockstack-0.11.0 → mockstack-0.11.1}/mockstack/tests/llm/test_ollama.py +0 -0
- {mockstack-0.11.0 → mockstack-0.11.1}/mockstack/tests/routers/__init__.py +0 -0
- {mockstack-0.11.0 → mockstack-0.11.1}/mockstack/tests/routers/test_catchall.py +0 -0
- {mockstack-0.11.0 → mockstack-0.11.1}/mockstack/tests/routers/test_homepage.py +0 -0
- {mockstack-0.11.0 → mockstack-0.11.1}/mockstack/tests/strategies/__init__.py +0 -0
- {mockstack-0.11.0 → mockstack-0.11.1}/mockstack/tests/strategies/test_create_mixin.py +0 -0
- {mockstack-0.11.0 → mockstack-0.11.1}/mockstack/tests/strategies/test_filefixtures.py +0 -0
- {mockstack-0.11.0 → mockstack-0.11.1}/mockstack/tests/test_display.py +0 -0
- {mockstack-0.11.0 → mockstack-0.11.1}/mockstack/tests/test_identifiers.py +0 -0
- {mockstack-0.11.0 → mockstack-0.11.1}/mockstack/tests/test_intent.py +0 -0
- {mockstack-0.11.0 → mockstack-0.11.1}/mockstack/tests/test_middleware.py +0 -0
- {mockstack-0.11.0 → mockstack-0.11.1}/mockstack/tests/test_rules.py +0 -0
- {mockstack-0.11.0 → mockstack-0.11.1}/mockstack/tests/test_telemetry.py +0 -0
- {mockstack-0.11.0 → mockstack-0.11.1}/mockstack/tests/test_templating.py +0 -0
- {mockstack-0.11.0 → mockstack-0.11.1}/mockstack.egg-info/SOURCES.txt +0 -0
- {mockstack-0.11.0 → mockstack-0.11.1}/mockstack.egg-info/dependency_links.txt +0 -0
- {mockstack-0.11.0 → mockstack-0.11.1}/mockstack.egg-info/entry_points.txt +0 -0
- {mockstack-0.11.0 → mockstack-0.11.1}/mockstack.egg-info/requires.txt +0 -0
- {mockstack-0.11.0 → mockstack-0.11.1}/mockstack.egg-info/top_level.txt +0 -0
- {mockstack-0.11.0 → mockstack-0.11.1}/pyproject.toml +0 -0
- {mockstack-0.11.0 → mockstack-0.11.1}/setup.cfg +0 -0
- {mockstack-0.11.0 → mockstack-0.11.1}/uv.lock +0 -0
|
@@ -25,7 +25,7 @@ from mockstack.templating import templates_env_provider
|
|
|
25
25
|
def maybe_update_response_headers(
|
|
26
26
|
response_headers: ResponseHeaders,
|
|
27
27
|
*,
|
|
28
|
-
|
|
28
|
+
content_length: int,
|
|
29
29
|
) -> ResponseHeaders:
|
|
30
30
|
"""Update the response headers if needed, e.g. to adjust for compression etc."""
|
|
31
31
|
_headers = response_headers.copy()
|
|
@@ -34,6 +34,8 @@ def maybe_update_response_headers(
|
|
|
34
34
|
# If the response is compressed, we need to remove the content-encoding header
|
|
35
35
|
# since httpx will automatically decompress the response while proxying.
|
|
36
36
|
_headers["content-encoding"] = "identity"
|
|
37
|
+
# content length needs to be adjusted as well for uncompressed content.
|
|
38
|
+
_headers["content-length"] = str(content_length)
|
|
37
39
|
|
|
38
40
|
return _headers
|
|
39
41
|
|
|
@@ -209,9 +211,10 @@ class ProxyRulesStrategy(BaseStrategy, CreateMixin):
|
|
|
209
211
|
|
|
210
212
|
resp = await client.send(req, stream=False)
|
|
211
213
|
content = resp.read()
|
|
214
|
+
|
|
212
215
|
response_headers = maybe_update_response_headers(
|
|
213
216
|
resp.headers,
|
|
214
|
-
|
|
217
|
+
content_length=len(content),
|
|
215
218
|
)
|
|
216
219
|
|
|
217
220
|
return Response(
|
|
@@ -359,15 +359,18 @@ async def test_proxy_rules_strategy_reverse_proxy(settings_reverse_proxy, span):
|
|
|
359
359
|
|
|
360
360
|
mock_client.send.assert_called_once()
|
|
361
361
|
|
|
362
|
-
def test_maybe_update_response_headers_updates_content_encoding():
|
|
363
|
-
"""Test maybe_update_response_headers updates content-encoding."""
|
|
364
|
-
headers = Headers(
|
|
365
|
-
{"content-encoding": "gzip", "content-type": "application/json"}
|
|
366
|
-
)
|
|
367
|
-
request_headers = Headers({"accept-encoding": "gzip"})
|
|
368
362
|
|
|
369
|
-
|
|
363
|
+
def test_maybe_update_response_headers_updates_content_encoding():
|
|
364
|
+
"""Test maybe_update_response_headers updates content-encoding."""
|
|
365
|
+
response_headers = httpx.Headers(
|
|
366
|
+
{"content-encoding": "gzip", "content-type": "application/json"}
|
|
367
|
+
)
|
|
368
|
+
|
|
369
|
+
updated_headers = maybe_update_response_headers(
|
|
370
|
+
response_headers=response_headers,
|
|
371
|
+
content_length=100,
|
|
372
|
+
)
|
|
370
373
|
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
+
assert updated_headers["content-encoding"] == "identity"
|
|
375
|
+
assert updated_headers["content-type"] == "application/json"
|
|
376
|
+
assert updated_headers["content-length"] == "100"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{mockstack-0.11.0 → mockstack-0.11.1}/examples/llm/templates/ollama-openai-v1-chat-completions.j2
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{mockstack-0.11.0 → mockstack-0.11.1}/mockstack/tests/fixtures/templates/example-template.j2
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|