Skip to content

Latest commit

 

History

History
86 lines (62 loc) · 1.61 KB

README.md

File metadata and controls

86 lines (62 loc) · 1.61 KB

Fast Mock

GitHub release (latest by date) Swagger Validator GitHub

Fast Mock is a very simple HTTP server mock, built using Fast API.

screencapture-localhost-8000-docs-2023-11-22-08_46_57

Usage/Examples

Create a mock request

curl --location 'fastmock.your-domain.com:8000/requests/create' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <your-token>' \
--data '{
  "method": "GET",
  "url": "https://example.com/path?param1=foo&param2=bar",
  "status_code": 200,
  "response": "{\"test\": 1}"
}'

Response Body

{
    "method": "GET",
    "status_code": 200,
    "id": 1,
    "endpoint": "/path",
    "parameters": "param1=foo&param2=bar",
    "owner_id": 1,
    "url_id": "8f5350fb-f63e-4795-889b-9060916eca75",
    "response": {
        "test": 1
    }
}

Retrieve the mocked response

curl --location '<url-id-from-previous-step>.your-domain.com:8000/path?param1=foo&param2=bar' \
--header 'Content-Type: application/json'

Response Body

{
    "test": 1
}

Run Locally

Clone the project

  git clone https://github.com/Jahn16/fast-mock.git

Go to the project directory

  cd fast-mock

Install dependencies

  pip install -r requirements

Start the server

  uvicorn app.main:app