mockstack 0.9.1__tar.gz → 0.9.3__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.9.1 → mockstack-0.9.3}/.env.example +1 -0
- mockstack-0.9.3/.github/ISSUE_TEMPLATE/bug_report.md +38 -0
- mockstack-0.9.3/.github/ISSUE_TEMPLATE/feature_request.md +20 -0
- {mockstack-0.9.1 → mockstack-0.9.3}/.gitignore +3 -0
- {mockstack-0.9.1 → mockstack-0.9.3}/.pre-commit-config.yaml +2 -1
- mockstack-0.9.3/CONTRIBUTING.md +136 -0
- {mockstack-0.9.1 → mockstack-0.9.3}/PKG-INFO +1 -1
- {mockstack-0.9.1 → mockstack-0.9.3}/mockstack/config.py +6 -1
- {mockstack-0.9.1 → mockstack-0.9.3}/mockstack/intent.py +3 -2
- {mockstack-0.9.1 → mockstack-0.9.3}/mockstack/main.py +1 -1
- {mockstack-0.9.1 → mockstack-0.9.3}/mockstack/strategies/proxyrules.py +10 -6
- mockstack-0.9.3/mockstack/tests/routers/__init__.py +0 -0
- mockstack-0.9.3/mockstack/tests/strategies/__init__.py +0 -0
- {mockstack-0.9.1 → mockstack-0.9.3}/mockstack/tests/test_intent.py +0 -2
- {mockstack-0.9.1 → mockstack-0.9.3}/mockstack.egg-info/PKG-INFO +1 -1
- {mockstack-0.9.1 → mockstack-0.9.3}/mockstack.egg-info/SOURCES.txt +5 -0
- mockstack-0.9.3/uv.lock +1425 -0
- mockstack-0.9.1/uv.lock +0 -1386
- {mockstack-0.9.1 → mockstack-0.9.3}/.dockerignore +0 -0
- {mockstack-0.9.1 → mockstack-0.9.3}/.github/workflows/ci.yml +0 -0
- {mockstack-0.9.1 → mockstack-0.9.3}/.github/workflows/publish-docs.yml +0 -0
- {mockstack-0.9.1 → mockstack-0.9.3}/.github/workflows/publish-to-dockerhub.yml +0 -0
- {mockstack-0.9.1 → mockstack-0.9.3}/.github/workflows/publish-to-pypi.yml +0 -0
- {mockstack-0.9.1 → mockstack-0.9.3}/CODE_OF_CONDUCT.md +0 -0
- {mockstack-0.9.1 → mockstack-0.9.3}/Dockerfile +0 -0
- {mockstack-0.9.1 → mockstack-0.9.3}/LICENSE +0 -0
- {mockstack-0.9.1 → mockstack-0.9.3}/README.md +0 -0
- {mockstack-0.9.1 → mockstack-0.9.3}/SECURITY.md +0 -0
- {mockstack-0.9.1 → mockstack-0.9.3}/docker-entrypoint.sh +0 -0
- {mockstack-0.9.1 → mockstack-0.9.3}/docs/assets/favicon.ico +0 -0
- {mockstack-0.9.1 → mockstack-0.9.3}/docs/assets/logo.png +0 -0
- {mockstack-0.9.1 → mockstack-0.9.3}/docs/assets/mockstack.png +0 -0
- {mockstack-0.9.1 → mockstack-0.9.3}/docs/configuration.md +0 -0
- {mockstack-0.9.1 → mockstack-0.9.3}/docs/ollama.md +0 -0
- {mockstack-0.9.1 → mockstack-0.9.3}/docs/strategies/base.md +0 -0
- {mockstack-0.9.1 → mockstack-0.9.3}/docs/strategies/filefixtures.md +0 -0
- {mockstack-0.9.1 → mockstack-0.9.3}/docs/strategies/proxyrules.md +0 -0
- {mockstack-0.9.1 → mockstack-0.9.3}/examples/filefixtures-with-templates/.env.example +0 -0
- {mockstack-0.9.1 → mockstack-0.9.3}/examples/filefixtures-with-templates/README.md +0 -0
- {mockstack-0.9.1 → mockstack-0.9.3}/examples/filefixtures-with-templates/templates/servicename-api-v1-items.j2 +0 -0
- {mockstack-0.9.1 → mockstack-0.9.3}/examples/filefixtures-with-templates/templates/servicename2-api-v2-user.533ec889-7c68-45c8-b21e-4a7e455d1234.j2 +0 -0
- {mockstack-0.9.1 → mockstack-0.9.3}/examples/llm/README.md +0 -0
- {mockstack-0.9.1 → mockstack-0.9.3}/examples/llm/mockstack-langchain-example.ipynb +0 -0
- {mockstack-0.9.1 → mockstack-0.9.3}/examples/llm/templates/ollama-openai-v1-chat-completions.j2 +0 -0
- {mockstack-0.9.1 → mockstack-0.9.3}/examples/llm/templates/openai-v1-chat-completions.j2 +0 -0
- {mockstack-0.9.1 → mockstack-0.9.3}/examples/llm/templates/openai-v1-deployments-gpt-4o-chat-completions.j2 +0 -0
- {mockstack-0.9.1 → mockstack-0.9.3}/examples/proxyrules-with-rules-file/.env.example +0 -0
- {mockstack-0.9.1 → mockstack-0.9.3}/examples/proxyrules-with-rules-file/README.md +0 -0
- {mockstack-0.9.1 → mockstack-0.9.3}/examples/proxyrules-with-rules-file/rules.yml +0 -0
- {mockstack-0.9.1 → mockstack-0.9.3}/mkdocs.yml +0 -0
- {mockstack-0.9.1 → mockstack-0.9.3}/mockstack/__init__.py +0 -0
- {mockstack-0.9.1 → mockstack-0.9.3}/mockstack/constants.py +0 -0
- {mockstack-0.9.1 → mockstack-0.9.3}/mockstack/display.py +0 -0
- {mockstack-0.9.1 → mockstack-0.9.3}/mockstack/exceptions.py +0 -0
- {mockstack-0.9.1 → mockstack-0.9.3}/mockstack/identifiers.py +0 -0
- {mockstack-0.9.1 → mockstack-0.9.3}/mockstack/lifespan.py +0 -0
- {mockstack-0.9.1 → mockstack-0.9.3}/mockstack/llm/__init__.py +0 -0
- {mockstack-0.9.1 → mockstack-0.9.3}/mockstack/llm/ollama.py +0 -0
- {mockstack-0.9.1 → mockstack-0.9.3}/mockstack/middleware.py +0 -0
- {mockstack-0.9.1 → mockstack-0.9.3}/mockstack/routers/__init__.py +0 -0
- {mockstack-0.9.1 → mockstack-0.9.3}/mockstack/routers/catchall.py +0 -0
- {mockstack-0.9.1 → mockstack-0.9.3}/mockstack/routers/homepage.py +0 -0
- {mockstack-0.9.1 → mockstack-0.9.3}/mockstack/strategies/__init__.py +0 -0
- {mockstack-0.9.1 → mockstack-0.9.3}/mockstack/strategies/base.py +0 -0
- {mockstack-0.9.1 → mockstack-0.9.3}/mockstack/strategies/create_mixin.py +0 -0
- {mockstack-0.9.1 → mockstack-0.9.3}/mockstack/strategies/factory.py +0 -0
- {mockstack-0.9.1 → mockstack-0.9.3}/mockstack/strategies/filefixtures.py +0 -0
- {mockstack-0.9.1 → mockstack-0.9.3}/mockstack/telemetry.py +0 -0
- {mockstack-0.9.1 → mockstack-0.9.3}/mockstack/templating.py +0 -0
- {mockstack-0.9.1 → mockstack-0.9.3}/mockstack/tests/__init__.py +0 -0
- {mockstack-0.9.1 → mockstack-0.9.3}/mockstack/tests/conftest.py +0 -0
- {mockstack-0.9.1/mockstack/tests/fixtures/templates → mockstack-0.9.3/mockstack/tests/fixtures}/__init__.py +0 -0
- {mockstack-0.9.1 → mockstack-0.9.3}/mockstack/tests/fixtures/proxyrules.yml +0 -0
- {mockstack-0.9.1/mockstack/tests/llm → mockstack-0.9.3/mockstack/tests/fixtures/templates}/__init__.py +0 -0
- {mockstack-0.9.1 → mockstack-0.9.3}/mockstack/tests/fixtures/templates/example-template.j2 +0 -0
- {mockstack-0.9.1/mockstack/tests/routers → mockstack-0.9.3/mockstack/tests/llm}/__init__.py +0 -0
- {mockstack-0.9.1 → mockstack-0.9.3}/mockstack/tests/llm/test_ollama.py +0 -0
- {mockstack-0.9.1 → mockstack-0.9.3}/mockstack/tests/routers/test_catchall.py +0 -0
- {mockstack-0.9.1 → mockstack-0.9.3}/mockstack/tests/routers/test_homepage.py +0 -0
- {mockstack-0.9.1 → mockstack-0.9.3}/mockstack/tests/strategies/test_create_mixin.py +0 -0
- {mockstack-0.9.1 → mockstack-0.9.3}/mockstack/tests/strategies/test_filefixtures.py +0 -0
- {mockstack-0.9.1 → mockstack-0.9.3}/mockstack/tests/strategies/test_proxyrules.py +0 -0
- {mockstack-0.9.1 → mockstack-0.9.3}/mockstack/tests/test_display.py +0 -0
- {mockstack-0.9.1 → mockstack-0.9.3}/mockstack/tests/test_identifiers.py +0 -0
- {mockstack-0.9.1 → mockstack-0.9.3}/mockstack/tests/test_middleware.py +0 -0
- {mockstack-0.9.1 → mockstack-0.9.3}/mockstack/tests/test_telemetry.py +0 -0
- {mockstack-0.9.1 → mockstack-0.9.3}/mockstack/tests/test_templating.py +0 -0
- {mockstack-0.9.1 → mockstack-0.9.3}/mockstack.egg-info/dependency_links.txt +0 -0
- {mockstack-0.9.1 → mockstack-0.9.3}/mockstack.egg-info/entry_points.txt +0 -0
- {mockstack-0.9.1 → mockstack-0.9.3}/mockstack.egg-info/requires.txt +0 -0
- {mockstack-0.9.1 → mockstack-0.9.3}/mockstack.egg-info/top_level.txt +0 -0
- {mockstack-0.9.1 → mockstack-0.9.3}/pyproject.toml +0 -0
- {mockstack-0.9.1 → mockstack-0.9.3}/setup.cfg +0 -0
|
@@ -18,6 +18,7 @@ FILEFIXTURES_ENABLE_TEMPLATES_FOR_POST = false
|
|
|
18
18
|
MOCKSTACK__PROXYRULES_RULES_FILENAME="/some/path/proxyrules.yml"
|
|
19
19
|
|
|
20
20
|
MOCKSTACK__PROXYRULES_SIMULATE_CREATE_ON_MISSING = true
|
|
21
|
+
MOCKSTACK__PROXYRULES_VERIFY_SSL_CERTIFICATES = true
|
|
21
22
|
|
|
22
23
|
# OpenTelemetry settings
|
|
23
24
|
MOCKSTACK__OPENTELEMETRY__ENABLED = true
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Bug report
|
|
3
|
+
about: Create a report to help us improve
|
|
4
|
+
title: ''
|
|
5
|
+
labels: ''
|
|
6
|
+
assignees: ''
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
**Describe the bug**
|
|
11
|
+
A clear and concise description of what the bug is.
|
|
12
|
+
|
|
13
|
+
**To Reproduce**
|
|
14
|
+
Steps to reproduce the behavior:
|
|
15
|
+
1. Go to '...'
|
|
16
|
+
2. Click on '....'
|
|
17
|
+
3. Scroll down to '....'
|
|
18
|
+
4. See error
|
|
19
|
+
|
|
20
|
+
**Expected behavior**
|
|
21
|
+
A clear and concise description of what you expected to happen.
|
|
22
|
+
|
|
23
|
+
**Screenshots**
|
|
24
|
+
If applicable, add screenshots to help explain your problem.
|
|
25
|
+
|
|
26
|
+
**Desktop (please complete the following information):**
|
|
27
|
+
- OS: [e.g. iOS]
|
|
28
|
+
- Browser [e.g. chrome, safari]
|
|
29
|
+
- Version [e.g. 22]
|
|
30
|
+
|
|
31
|
+
**Smartphone (please complete the following information):**
|
|
32
|
+
- Device: [e.g. iPhone6]
|
|
33
|
+
- OS: [e.g. iOS8.1]
|
|
34
|
+
- Browser [e.g. stock browser, safari]
|
|
35
|
+
- Version [e.g. 22]
|
|
36
|
+
|
|
37
|
+
**Additional context**
|
|
38
|
+
Add any other context about the problem here.
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Feature request
|
|
3
|
+
about: Suggest an idea for this project
|
|
4
|
+
title: ''
|
|
5
|
+
labels: ''
|
|
6
|
+
assignees: ''
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
**Is your feature request related to a problem? Please describe.**
|
|
11
|
+
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
|
12
|
+
|
|
13
|
+
**Describe the solution you'd like**
|
|
14
|
+
A clear and concise description of what you want to happen.
|
|
15
|
+
|
|
16
|
+
**Describe alternatives you've considered**
|
|
17
|
+
A clear and concise description of any alternative solutions or features you've considered.
|
|
18
|
+
|
|
19
|
+
**Additional context**
|
|
20
|
+
Add any other context or screenshots about the feature request here.
|
|
@@ -19,11 +19,12 @@ repos:
|
|
|
19
19
|
- id: check-yaml
|
|
20
20
|
args: [ --unsafe ]
|
|
21
21
|
- id: detect-aws-credentials
|
|
22
|
+
args: [ --allow-missing-credentials ]
|
|
22
23
|
- id: detect-private-key
|
|
23
24
|
- id: end-of-file-fixer
|
|
24
25
|
- id: trailing-whitespace
|
|
25
26
|
- repo: https://github.com/astral-sh/ruff-pre-commit
|
|
26
|
-
rev: v0.
|
|
27
|
+
rev: v0.11.9
|
|
27
28
|
hooks:
|
|
28
29
|
# Run the linter.
|
|
29
30
|
- id: ruff
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
# Contributing to mockstack
|
|
2
|
+
|
|
3
|
+
Thank you for your interest in contributing to mockstack! We welcome contributions from the community and appreciate your help in making this project better.
|
|
4
|
+
|
|
5
|
+
## Getting Started
|
|
6
|
+
|
|
7
|
+
### Prerequisites
|
|
8
|
+
|
|
9
|
+
- Python 3.11 or higher
|
|
10
|
+
- Git
|
|
11
|
+
- A GitHub account
|
|
12
|
+
|
|
13
|
+
### Setting Up Your Development Environment
|
|
14
|
+
|
|
15
|
+
1. Fork the repository on GitHub
|
|
16
|
+
2. Clone your fork locally:
|
|
17
|
+
```bash
|
|
18
|
+
git clone https://github.com/YOUR_USERNAME/mockstack.git
|
|
19
|
+
cd mockstack
|
|
20
|
+
```
|
|
21
|
+
3. Create a virtual environment:
|
|
22
|
+
```bash
|
|
23
|
+
uv venv
|
|
24
|
+
source .venv/bin/activate # On Windows: venv\Scripts\activate
|
|
25
|
+
```
|
|
26
|
+
4. Install the package in development mode:
|
|
27
|
+
```bash
|
|
28
|
+
uv sync
|
|
29
|
+
pip install -e .
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## How to Contribute
|
|
33
|
+
|
|
34
|
+
### Reporting Bugs
|
|
35
|
+
|
|
36
|
+
If you find a bug, please create an issue using our **Bug Report** template. This helps us understand and reproduce the issue quickly. Include:
|
|
37
|
+
|
|
38
|
+
- A clear description of the problem
|
|
39
|
+
- Steps to reproduce the issue
|
|
40
|
+
- Expected vs actual behavior
|
|
41
|
+
- Your environment details (Python version, pytest version, etc.)
|
|
42
|
+
- Any relevant code snippets or error messages
|
|
43
|
+
|
|
44
|
+
### Suggesting Features
|
|
45
|
+
|
|
46
|
+
We welcome feature suggestions! Please use our **Feature Request** template when creating an issue. Help us understand:
|
|
47
|
+
|
|
48
|
+
- The problem your feature would solve
|
|
49
|
+
- How you envision the feature working
|
|
50
|
+
- Any alternatives you've considered
|
|
51
|
+
- Whether you're willing to help implement it
|
|
52
|
+
|
|
53
|
+
### Contributing Code
|
|
54
|
+
|
|
55
|
+
1. **Create a branch** for your work:
|
|
56
|
+
```bash
|
|
57
|
+
git checkout -b feature/your-feature-name
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
2. **Make your changes** following our coding standards:
|
|
61
|
+
- Write clear, readable code
|
|
62
|
+
- Follow PEP 8 style guidelines
|
|
63
|
+
- Add docstrings to new functions and classes
|
|
64
|
+
- Keep commits focused and atomic
|
|
65
|
+
|
|
66
|
+
3. **Add tests** for your changes:
|
|
67
|
+
- All new functionality should include tests
|
|
68
|
+
- Ensure existing tests still pass
|
|
69
|
+
- Aim for good test coverage
|
|
70
|
+
|
|
71
|
+
4. **Run the test suite**:
|
|
72
|
+
```bash
|
|
73
|
+
pytest
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
5. **Commit your changes**:
|
|
77
|
+
```bash
|
|
78
|
+
git add .
|
|
79
|
+
git commit -m "Clear description of your changes"
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
6. **Push to your fork**:
|
|
83
|
+
```bash
|
|
84
|
+
git push origin feature/your-feature-name
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
7. **Create a Pull Request** on GitHub with:
|
|
88
|
+
- A clear title and description
|
|
89
|
+
- Reference to any related issues
|
|
90
|
+
- Description of what you changed and why
|
|
91
|
+
|
|
92
|
+
### Code Style
|
|
93
|
+
|
|
94
|
+
- Follow PEP 8 Python style guidelines. We use `ruff` for linting and formatting.
|
|
95
|
+
- Use meaningful variable and function names
|
|
96
|
+
- Write clear commit messages
|
|
97
|
+
- Keep line length reasonable (ideally under 120 characters)
|
|
98
|
+
- Use type hints where appropriate
|
|
99
|
+
|
|
100
|
+
### Testing
|
|
101
|
+
|
|
102
|
+
- Write tests for all new functionality
|
|
103
|
+
- Ensure all tests pass before submitting a PR
|
|
104
|
+
- Include both positive and negative test cases
|
|
105
|
+
- Test edge cases and error conditions
|
|
106
|
+
|
|
107
|
+
## Development Workflow
|
|
108
|
+
|
|
109
|
+
1. Check existing issues and PRs to avoid duplicate work
|
|
110
|
+
2. For significant changes, consider opening an issue first to discuss the approach
|
|
111
|
+
3. Create a focused branch for each feature or bug fix
|
|
112
|
+
4. Write clear, descriptive commit messages
|
|
113
|
+
5. Keep PRs reasonably sized and focused
|
|
114
|
+
6. Be responsive to feedback during code review
|
|
115
|
+
|
|
116
|
+
## Getting Help
|
|
117
|
+
|
|
118
|
+
- Check existing issues and documentation first
|
|
119
|
+
- Create a new issue if you need help or have questions
|
|
120
|
+
- Be patient and respectful in all interactions
|
|
121
|
+
|
|
122
|
+
## Code of Conduct
|
|
123
|
+
|
|
124
|
+
Please be respectful and constructive in all interactions. We're all here to learn and improve the project together.
|
|
125
|
+
|
|
126
|
+
See our CODE_OF_CONDUCT.md file in this repository for further details.
|
|
127
|
+
|
|
128
|
+
## License
|
|
129
|
+
|
|
130
|
+
By contributing to mockstack, you agree that your contributions will be licensed under the same license as the project.
|
|
131
|
+
|
|
132
|
+
See our LICENSE file in this repository for further details.
|
|
133
|
+
|
|
134
|
+
---
|
|
135
|
+
|
|
136
|
+
Thank you for contributing to mockstack! 🎉
|
|
@@ -75,13 +75,18 @@ class Settings(BaseSettings):
|
|
|
75
75
|
# or reverse proxy the request to the target URL "silently".
|
|
76
76
|
proxyrules_redirect_via: ProxyRulesRedirectVia = ProxyRulesRedirectVia.REVERSE_PROXY
|
|
77
77
|
|
|
78
|
-
#
|
|
78
|
+
# default timeout for reverse proxy requests. given in seconds. None disables timeouts.
|
|
79
79
|
proxyrules_reverse_proxy_timeout: float | None = 10.0
|
|
80
80
|
|
|
81
81
|
# controls behavior of proxying. Whether to simulate creation of resources
|
|
82
82
|
# when a POST request is made to a resource that doesn't match any rules..
|
|
83
83
|
proxyrules_simulate_create_on_missing: CliImplicitFlag[bool] = False
|
|
84
84
|
|
|
85
|
+
# controls behavior of proxying. Whether to verify SSL certificates.
|
|
86
|
+
# this is useful for testing against services that use self-signed certificates.
|
|
87
|
+
# disable with caution!
|
|
88
|
+
proxyrules_verify_ssl_certificates: CliImplicitFlag[bool] = True
|
|
89
|
+
|
|
85
90
|
# metadata fields to inject into created resources.
|
|
86
91
|
# A few template fields are available. See documentation for more details.
|
|
87
92
|
created_resource_metadata: CliSuppress[dict[str, Any]] = {
|
|
@@ -28,6 +28,7 @@ def looks_like_a_search(request: Request) -> bool:
|
|
|
28
28
|
request.url.path.endswith("_search"),
|
|
29
29
|
request.url.path.endswith("/search"),
|
|
30
30
|
request.url.path.endswith("_query"),
|
|
31
|
+
request.url.path.endswith("/query"),
|
|
31
32
|
)
|
|
32
33
|
)
|
|
33
34
|
|
|
@@ -43,8 +44,8 @@ def looks_like_a_command(request: Request) -> bool:
|
|
|
43
44
|
(
|
|
44
45
|
request.url.path.endswith("_command"),
|
|
45
46
|
request.url.path.endswith("/command"),
|
|
46
|
-
request.url.path.endswith("
|
|
47
|
-
request.url.path.endswith("/
|
|
47
|
+
request.url.path.endswith("_cmd"),
|
|
48
|
+
request.url.path.endswith("/cmd"),
|
|
48
49
|
request.url.path.endswith("_run"),
|
|
49
50
|
request.url.path.endswith("/run"),
|
|
50
51
|
request.url.path.endswith("_execute"),
|
|
@@ -68,12 +68,13 @@ class ProxyRulesStrategy(BaseStrategy, CreateMixin):
|
|
|
68
68
|
|
|
69
69
|
def __init__(self, settings: Settings, *args, **kwargs):
|
|
70
70
|
super().__init__(settings, *args, **kwargs)
|
|
71
|
-
self.
|
|
71
|
+
self.created_resource_metadata = settings.created_resource_metadata
|
|
72
|
+
self.missing_resource_fields = settings.missing_resource_fields
|
|
72
73
|
self.redirect_via = settings.proxyrules_redirect_via
|
|
73
74
|
self.reverse_proxy_timeout = settings.proxyrules_reverse_proxy_timeout
|
|
75
|
+
self.rules_filename = settings.proxyrules_rules_filename
|
|
74
76
|
self.simulate_create_on_missing = settings.proxyrules_simulate_create_on_missing
|
|
75
|
-
self.
|
|
76
|
-
self.missing_resource_fields = settings.missing_resource_fields
|
|
77
|
+
self.verify_ssl_certificates = settings.proxyrules_verify_ssl_certificates
|
|
77
78
|
|
|
78
79
|
def __str__(self) -> str:
|
|
79
80
|
return (
|
|
@@ -81,7 +82,8 @@ class ProxyRulesStrategy(BaseStrategy, CreateMixin):
|
|
|
81
82
|
f"rules_filename: {self.rules_filename}.\n "
|
|
82
83
|
f"redirect_via: [medium_purple]{self.redirect_via}[/medium_purple].\n "
|
|
83
84
|
f"simulate_create_on_missing: {self.simulate_create_on_missing}.\n "
|
|
84
|
-
f"reverse_proxy_timeout: {self.reverse_proxy_timeout}"
|
|
85
|
+
f"reverse_proxy_timeout: {self.reverse_proxy_timeout}\n "
|
|
86
|
+
f"verify_ssl_certificates: {self.verify_ssl_certificates}\n "
|
|
85
87
|
)
|
|
86
88
|
|
|
87
89
|
@cached_property
|
|
@@ -130,7 +132,7 @@ class ProxyRulesStrategy(BaseStrategy, CreateMixin):
|
|
|
130
132
|
)
|
|
131
133
|
|
|
132
134
|
url = rule.apply(request)
|
|
133
|
-
self.logger.info(f"Redirecting to: {url}")
|
|
135
|
+
self.logger.info(f"[rule:{rule.name}] Redirecting to: {url}")
|
|
134
136
|
self.update_opentelemetry(request, rule, url)
|
|
135
137
|
|
|
136
138
|
match self.redirect_via:
|
|
@@ -153,7 +155,9 @@ class ProxyRulesStrategy(BaseStrategy, CreateMixin):
|
|
|
153
155
|
|
|
154
156
|
async def reverse_proxy(self, request: Request, url: str) -> Response:
|
|
155
157
|
"""Reverse proxy the request to the target URL."""
|
|
156
|
-
async with httpx.AsyncClient(
|
|
158
|
+
async with httpx.AsyncClient(
|
|
159
|
+
timeout=self.reverse_proxy_timeout, verify=self.verify_ssl_certificates
|
|
160
|
+
) as client:
|
|
157
161
|
request_content = await request.body()
|
|
158
162
|
request_headers = self.reverse_proxy_headers(request.headers, url=url)
|
|
159
163
|
req = client.build_request(
|
|
File without changes
|
|
File without changes
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
.gitignore
|
|
4
4
|
.pre-commit-config.yaml
|
|
5
5
|
CODE_OF_CONDUCT.md
|
|
6
|
+
CONTRIBUTING.md
|
|
6
7
|
Dockerfile
|
|
7
8
|
LICENSE
|
|
8
9
|
README.md
|
|
@@ -11,6 +12,8 @@ docker-entrypoint.sh
|
|
|
11
12
|
mkdocs.yml
|
|
12
13
|
pyproject.toml
|
|
13
14
|
uv.lock
|
|
15
|
+
.github/ISSUE_TEMPLATE/bug_report.md
|
|
16
|
+
.github/ISSUE_TEMPLATE/feature_request.md
|
|
14
17
|
.github/workflows/ci.yml
|
|
15
18
|
.github/workflows/publish-docs.yml
|
|
16
19
|
.github/workflows/publish-to-dockerhub.yml
|
|
@@ -72,6 +75,7 @@ mockstack/tests/test_intent.py
|
|
|
72
75
|
mockstack/tests/test_middleware.py
|
|
73
76
|
mockstack/tests/test_telemetry.py
|
|
74
77
|
mockstack/tests/test_templating.py
|
|
78
|
+
mockstack/tests/fixtures/__init__.py
|
|
75
79
|
mockstack/tests/fixtures/proxyrules.yml
|
|
76
80
|
mockstack/tests/fixtures/templates/__init__.py
|
|
77
81
|
mockstack/tests/fixtures/templates/example-template.j2
|
|
@@ -80,6 +84,7 @@ mockstack/tests/llm/test_ollama.py
|
|
|
80
84
|
mockstack/tests/routers/__init__.py
|
|
81
85
|
mockstack/tests/routers/test_catchall.py
|
|
82
86
|
mockstack/tests/routers/test_homepage.py
|
|
87
|
+
mockstack/tests/strategies/__init__.py
|
|
83
88
|
mockstack/tests/strategies/test_create_mixin.py
|
|
84
89
|
mockstack/tests/strategies/test_filefixtures.py
|
|
85
90
|
mockstack/tests/strategies/test_proxyrules.py
|