A mini mock server for http requests
Project description
Mini Mock Server
A mini mock server for http requests.
Features
- Start a http mock server using the lib
http.server. - Delay requests to simulate slow endpoints.
- Return random responses on the same route to simulates success and error cases.
Installation
pip install mini-mock-server
Usage
- Create
mock-api.jsonfile to routes especifications.
{
"/": [
{
"url": "/users",
"method": "GET",
"response": [
{
"status_code": 200,
"body": [
{"id": 1, "name": "Mario"},
{"id": 2, "name": "Luigi"}
]
},
{
"status_code": 400,
"body": {"error": "Bad request custom message"}
}
]
}
],
"/api": [
{
"url": "/products/:id",
"method": "GET",
"response": {
"status_code": 200,
"body": {
"id": 1,
"name": "Product 001",
"price": 115.51
}
}
}
]
}
- Start the mock server
mini-mock-server mock-api.json
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mini_mock_server-0.0.25-py3-none-any.whl.
File metadata
- Download URL: mini_mock_server-0.0.25-py3-none-any.whl
- Upload date:
- Size: 12.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
12acf811561bade0bf1de31d3c863c1b7c8633cd3fc1d78f6c3ac38534a24afb
|
|
| MD5 |
69202e0d7776a91df48ed2807c4f78c5
|
|
| BLAKE2b-256 |
7cf4118ce38fe454a346bb197118df11480d320e14fdac905a4a50401443e096
|