Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
At a glance
Goal: Specify a custom mocks file for the MockResponsePlugin
Time: 3 minutes
Plugins: MockResponsePlugin, GraphMockResponsePlugin
Prerequisites: Set up Dev Proxy
By default, the MockResponsePlugin and GraphMockResponsePlugin Dev Proxy plugins look for a file called mocks.json in the same folder as the Dev Proxy configuration file.
To use a file with a different name, use:
devproxy --mocks-file my-mocks.json
Dev Proxy resolves the path that you pass with --mocks-file relative to the configuration file, not the current working directory. For more information, see Resolve relative paths.
Alternatively, you can specify the mocks file in the devproxyrc.json configuration file. Dev Proxy automatically reloads its configuration when you save changes, so you don't need to restart the proxy.
File: devproxyrc.json
{
"mocksPlugin": {
"mocksFile": "mocks.json"
}
}
Learn more about the MockResponsePlugin.
See also
- Mock responses - Complete mocking guide
- MockResponsePlugin - Full reference
- Glossary - Dev Proxy terminology