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.
Files changed (94) hide show
  1. {mockstack-0.11.0 → mockstack-0.11.1}/PKG-INFO +1 -1
  2. {mockstack-0.11.0 → mockstack-0.11.1}/mockstack/strategies/proxyrules.py +5 -2
  3. {mockstack-0.11.0 → mockstack-0.11.1}/mockstack/tests/strategies/test_proxyrules.py +13 -10
  4. {mockstack-0.11.0 → mockstack-0.11.1}/mockstack.egg-info/PKG-INFO +1 -1
  5. {mockstack-0.11.0 → mockstack-0.11.1}/.dockerignore +0 -0
  6. {mockstack-0.11.0 → mockstack-0.11.1}/.env.example +0 -0
  7. {mockstack-0.11.0 → mockstack-0.11.1}/.github/ISSUE_TEMPLATE/bug_report.md +0 -0
  8. {mockstack-0.11.0 → mockstack-0.11.1}/.github/ISSUE_TEMPLATE/feature_request.md +0 -0
  9. {mockstack-0.11.0 → mockstack-0.11.1}/.github/workflows/ci.yml +0 -0
  10. {mockstack-0.11.0 → mockstack-0.11.1}/.github/workflows/publish-docs.yml +0 -0
  11. {mockstack-0.11.0 → mockstack-0.11.1}/.github/workflows/publish-to-dockerhub.yml +0 -0
  12. {mockstack-0.11.0 → mockstack-0.11.1}/.github/workflows/publish-to-pypi.yml +0 -0
  13. {mockstack-0.11.0 → mockstack-0.11.1}/.gitignore +0 -0
  14. {mockstack-0.11.0 → mockstack-0.11.1}/.pre-commit-config.yaml +0 -0
  15. {mockstack-0.11.0 → mockstack-0.11.1}/CODE_OF_CONDUCT.md +0 -0
  16. {mockstack-0.11.0 → mockstack-0.11.1}/CONTRIBUTING.md +0 -0
  17. {mockstack-0.11.0 → mockstack-0.11.1}/Dockerfile +0 -0
  18. {mockstack-0.11.0 → mockstack-0.11.1}/LICENSE +0 -0
  19. {mockstack-0.11.0 → mockstack-0.11.1}/README.md +0 -0
  20. {mockstack-0.11.0 → mockstack-0.11.1}/SECURITY.md +0 -0
  21. {mockstack-0.11.0 → mockstack-0.11.1}/docker-entrypoint.sh +0 -0
  22. {mockstack-0.11.0 → mockstack-0.11.1}/docs/assets/favicon.ico +0 -0
  23. {mockstack-0.11.0 → mockstack-0.11.1}/docs/assets/logo.png +0 -0
  24. {mockstack-0.11.0 → mockstack-0.11.1}/docs/assets/mockstack.png +0 -0
  25. {mockstack-0.11.0 → mockstack-0.11.1}/docs/configuration.md +0 -0
  26. {mockstack-0.11.0 → mockstack-0.11.1}/docs/ollama.md +0 -0
  27. {mockstack-0.11.0 → mockstack-0.11.1}/docs/strategies/base.md +0 -0
  28. {mockstack-0.11.0 → mockstack-0.11.1}/docs/strategies/filefixtures.md +0 -0
  29. {mockstack-0.11.0 → mockstack-0.11.1}/docs/strategies/proxyrules.md +0 -0
  30. {mockstack-0.11.0 → mockstack-0.11.1}/examples/filefixtures-with-templates/.env.example +0 -0
  31. {mockstack-0.11.0 → mockstack-0.11.1}/examples/filefixtures-with-templates/README.md +0 -0
  32. {mockstack-0.11.0 → mockstack-0.11.1}/examples/filefixtures-with-templates/templates/servicename-api-v1-items.j2 +0 -0
  33. {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
  34. {mockstack-0.11.0 → mockstack-0.11.1}/examples/llm/README.md +0 -0
  35. {mockstack-0.11.0 → mockstack-0.11.1}/examples/llm/mockstack-langchain-example.ipynb +0 -0
  36. {mockstack-0.11.0 → mockstack-0.11.1}/examples/llm/templates/ollama-openai-v1-chat-completions.j2 +0 -0
  37. {mockstack-0.11.0 → mockstack-0.11.1}/examples/llm/templates/openai-v1-chat-completions.j2 +0 -0
  38. {mockstack-0.11.0 → mockstack-0.11.1}/examples/llm/templates/openai-v1-deployments-gpt-4o-chat-completions.j2 +0 -0
  39. {mockstack-0.11.0 → mockstack-0.11.1}/examples/proxyrules-with-rules-file/.env.example +0 -0
  40. {mockstack-0.11.0 → mockstack-0.11.1}/examples/proxyrules-with-rules-file/README.md +0 -0
  41. {mockstack-0.11.0 → mockstack-0.11.1}/examples/proxyrules-with-rules-file/rules.yml +0 -0
  42. {mockstack-0.11.0 → mockstack-0.11.1}/mkdocs.yml +0 -0
  43. {mockstack-0.11.0 → mockstack-0.11.1}/mockstack/__init__.py +0 -0
  44. {mockstack-0.11.0 → mockstack-0.11.1}/mockstack/config.py +0 -0
  45. {mockstack-0.11.0 → mockstack-0.11.1}/mockstack/constants.py +0 -0
  46. {mockstack-0.11.0 → mockstack-0.11.1}/mockstack/display.py +0 -0
  47. {mockstack-0.11.0 → mockstack-0.11.1}/mockstack/exceptions.py +0 -0
  48. {mockstack-0.11.0 → mockstack-0.11.1}/mockstack/identifiers.py +0 -0
  49. {mockstack-0.11.0 → mockstack-0.11.1}/mockstack/intent.py +0 -0
  50. {mockstack-0.11.0 → mockstack-0.11.1}/mockstack/lifespan.py +0 -0
  51. {mockstack-0.11.0 → mockstack-0.11.1}/mockstack/llm/__init__.py +0 -0
  52. {mockstack-0.11.0 → mockstack-0.11.1}/mockstack/llm/ollama.py +0 -0
  53. {mockstack-0.11.0 → mockstack-0.11.1}/mockstack/main.py +0 -0
  54. {mockstack-0.11.0 → mockstack-0.11.1}/mockstack/middleware.py +0 -0
  55. {mockstack-0.11.0 → mockstack-0.11.1}/mockstack/routers/__init__.py +0 -0
  56. {mockstack-0.11.0 → mockstack-0.11.1}/mockstack/routers/catchall.py +0 -0
  57. {mockstack-0.11.0 → mockstack-0.11.1}/mockstack/routers/homepage.py +0 -0
  58. {mockstack-0.11.0 → mockstack-0.11.1}/mockstack/rules.py +0 -0
  59. {mockstack-0.11.0 → mockstack-0.11.1}/mockstack/strategies/__init__.py +0 -0
  60. {mockstack-0.11.0 → mockstack-0.11.1}/mockstack/strategies/base.py +0 -0
  61. {mockstack-0.11.0 → mockstack-0.11.1}/mockstack/strategies/create_mixin.py +0 -0
  62. {mockstack-0.11.0 → mockstack-0.11.1}/mockstack/strategies/factory.py +0 -0
  63. {mockstack-0.11.0 → mockstack-0.11.1}/mockstack/strategies/filefixtures.py +0 -0
  64. {mockstack-0.11.0 → mockstack-0.11.1}/mockstack/telemetry.py +0 -0
  65. {mockstack-0.11.0 → mockstack-0.11.1}/mockstack/templating.py +0 -0
  66. {mockstack-0.11.0 → mockstack-0.11.1}/mockstack/tests/__init__.py +0 -0
  67. {mockstack-0.11.0 → mockstack-0.11.1}/mockstack/tests/conftest.py +0 -0
  68. {mockstack-0.11.0 → mockstack-0.11.1}/mockstack/tests/fixtures/__init__.py +0 -0
  69. {mockstack-0.11.0 → mockstack-0.11.1}/mockstack/tests/fixtures/proxyrules.yml +0 -0
  70. {mockstack-0.11.0 → mockstack-0.11.1}/mockstack/tests/fixtures/templates/__init__.py +0 -0
  71. {mockstack-0.11.0 → mockstack-0.11.1}/mockstack/tests/fixtures/templates/example-template.j2 +0 -0
  72. {mockstack-0.11.0 → mockstack-0.11.1}/mockstack/tests/llm/__init__.py +0 -0
  73. {mockstack-0.11.0 → mockstack-0.11.1}/mockstack/tests/llm/test_ollama.py +0 -0
  74. {mockstack-0.11.0 → mockstack-0.11.1}/mockstack/tests/routers/__init__.py +0 -0
  75. {mockstack-0.11.0 → mockstack-0.11.1}/mockstack/tests/routers/test_catchall.py +0 -0
  76. {mockstack-0.11.0 → mockstack-0.11.1}/mockstack/tests/routers/test_homepage.py +0 -0
  77. {mockstack-0.11.0 → mockstack-0.11.1}/mockstack/tests/strategies/__init__.py +0 -0
  78. {mockstack-0.11.0 → mockstack-0.11.1}/mockstack/tests/strategies/test_create_mixin.py +0 -0
  79. {mockstack-0.11.0 → mockstack-0.11.1}/mockstack/tests/strategies/test_filefixtures.py +0 -0
  80. {mockstack-0.11.0 → mockstack-0.11.1}/mockstack/tests/test_display.py +0 -0
  81. {mockstack-0.11.0 → mockstack-0.11.1}/mockstack/tests/test_identifiers.py +0 -0
  82. {mockstack-0.11.0 → mockstack-0.11.1}/mockstack/tests/test_intent.py +0 -0
  83. {mockstack-0.11.0 → mockstack-0.11.1}/mockstack/tests/test_middleware.py +0 -0
  84. {mockstack-0.11.0 → mockstack-0.11.1}/mockstack/tests/test_rules.py +0 -0
  85. {mockstack-0.11.0 → mockstack-0.11.1}/mockstack/tests/test_telemetry.py +0 -0
  86. {mockstack-0.11.0 → mockstack-0.11.1}/mockstack/tests/test_templating.py +0 -0
  87. {mockstack-0.11.0 → mockstack-0.11.1}/mockstack.egg-info/SOURCES.txt +0 -0
  88. {mockstack-0.11.0 → mockstack-0.11.1}/mockstack.egg-info/dependency_links.txt +0 -0
  89. {mockstack-0.11.0 → mockstack-0.11.1}/mockstack.egg-info/entry_points.txt +0 -0
  90. {mockstack-0.11.0 → mockstack-0.11.1}/mockstack.egg-info/requires.txt +0 -0
  91. {mockstack-0.11.0 → mockstack-0.11.1}/mockstack.egg-info/top_level.txt +0 -0
  92. {mockstack-0.11.0 → mockstack-0.11.1}/pyproject.toml +0 -0
  93. {mockstack-0.11.0 → mockstack-0.11.1}/setup.cfg +0 -0
  94. {mockstack-0.11.0 → mockstack-0.11.1}/uv.lock +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mockstack
3
- Version: 0.11.0
3
+ Version: 0.11.1
4
4
  Summary: An API mocking workhorse
5
5
  Author-email: Adam Ever-Hadani <mockstack.contact@gmail.com>
6
6
  License-Expression: MIT
@@ -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
- request_headers: Headers,
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
- request_headers=request.headers,
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
- updated_headers = maybe_update_response_headers(headers, request_headers)
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
- assert updated_headers["content-encoding"] == "identity"
372
- assert updated_headers["content-type"] == "application/json"
373
- assert updated_headers["accept-encoding"] == "gzip"
374
+ assert updated_headers["content-encoding"] == "identity"
375
+ assert updated_headers["content-type"] == "application/json"
376
+ assert updated_headers["content-length"] == "100"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mockstack
3
- Version: 0.11.0
3
+ Version: 0.11.1
4
4
  Summary: An API mocking workhorse
5
5
  Author-email: Adam Ever-Hadani <mockstack.contact@gmail.com>
6
6
  License-Expression: MIT
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