Responses behaviour
Last updated
Last updated
As developers we appreciate the versatility of the tools we use in our regular developments and how they improve our productivity. That's why Mockly seeks to improve your development speed helping you where others can't.
One thing we love in our developments it's the ability to change the services responses as we desire to check how the application behave in different scenarios.
To modify services default responses you need to create, at least, one file called {name}.responses.json
. This file should contain a responses
key with the responses configuration you want to change. This key contains a configuration array where every item should follow the next schema:
Now you've learnt how you can configure the responses let see an example:
You can use a provided JSON schema to validate this file
With this configuration the next GET
request to /me
will return a 401
status code and the POST
requests to /artists
will return a 500
status code.
Name
Type
Required
Description
body
object
| string
false
Response body
cookies
object
false
Cookies setted by the response
delay
number
false
Determines how long takes the request to be resolved. Overrides generic delay configuration.
headers
object
false
Headers returned in the response
path
string
true
Request URI to match
method
string
true
Request HTTP method to match
status
string
false
Response status code. Should be a valid HTTP status code.