MockProxy is a lightweight browser extension designed to simplify API testing and local development. Effortlessly intercept HTTP requests, redirect them to your local Node.js server, and respond with pre-configured mock data.
200
, 400
, 404
).manifest.json
file./api/v1/resource/[\\d]{5}
).chrome://extensions/
.manifest.json
file in the extension directory with your project settings (see Configuration).The plugin uses a file to define projects, domains, and requests. Here’s an example configuration:
{
"domains": [
"https://api.dev.example.com",
"https://api.preprod.example.com",
"https://api.example.com"
],
"requests": [
{
"name": "Get Dummy Data",
"url": "/api/v1/health",
"method": "GET",
"response": {
"200": "./health.json",
"204": "",
"400": "./badRequest.json"
}
},
{
"name": "Post Dummy Data",
"url": "/api/v2/foo/[\\d]{5,10}",
"method": "POST",
"response": {
"200": "../mock/health-post.json",
"400": "./badRequest.json"
}
},
{
"name": "Put Dummy Data",
"url": "/api/v1/return/[\\d]{4,10}/[\\d]{2,10}",
"method": "PUT",
"response": {
"200": "../mock/health-put.json",
"400": "./badRequest.json"
}
}
]
}
domains
: List of domains where the plugin will intercept requests.requests
: Define individual endpoints with URL patterns, HTTP methods, and corresponding response files.MockProxy requires the following permissions to function:
activeTab
: Access the current tab to determine the domain and apply rules contextually.storage
: Store user preferences, such as active projects and selected statuses.declarativeNetRequest
: Intercept and redirect HTTP requests to the local Node.js server.We welcome contributions! To get started:
git checkout -b feature/your-feature
).git commit -m 'Add new feature'
).git push origin feature/your-feature
).This project is licensed under the MIT License.
If you encounter any issues or have feature suggestions, feel free to open an issue or join the discussion here: https://github.com/wesflo/browser-mock/discussions.
Special thanks to the open-source community for providing tools and inspiration for this project.