Response is the main entity for Mockadillo, it gives you the flexibility to build what you need.


The fields available when defining a response are Name, Status, Default Response flag, Conditions, Header and Body mirroring, Response Headers, Response Body and Response latency. These combined can give you huge control over how the route behaves depending on the given Request. You can add error pages that are returned when certain conditions are met, such as missing or invalid Headers, such as missing or invalid Body values or when your Route is accessed from an invalid Origin.


When you wish to test your code you may want to see what you are actually sending to the backend, for this use can use mirroring. When mirroring is activated, no matter what you set for Response Headers or Body you will always get the same data that you have sent to the endpoint.


Here you define the response headers. You are presented by two default inputs which you can use to set your first response header. You can add new headers by clicking on the + Add another button or remove existing ones by clicking on Remove. These values will be returned when the response is matched.


Defining conditions empowers you to have multiple responses for the same route. You want to test negative paths, like a missing parameter, or test positive paths like creating multiple resources. This can be easily accomplished with response conditions.

Response conditions are a JSON object that defines what to look for in your request. You can define Header based conditions, Body based conditions and Origin based conditions. The condition is defined by it’s Source, Kind and Value properties.

Source represents the holder of the information to verify. For headers it’s the header name. For body depending on the content-type header it can be the JSON Path to the property, or the form name value. There are also two special values $$body$$ (which seeks through the entire body) and $$size$$ (which runs comparison against the body size). For the origin it’s not used because we analyze the Origin header from the request.

The Kind property represents the comparison for the value. It can be of the following values:

  • exists

  • nexists

  • eq

  • contains

  • neq

  • ncontains

  • gt

  • lt

The gt and lt are only used with the special value $$size$$ and the rest are used for all of the other conditions.

The Value holds the required value the request will be compared against. If you set multiple conditions as of right now they will be treated as AND conditions. The first response with most satisfying conditions is selected. If you have multiple responses with x matching conditions the first one matched will be returned. If you have no responses satisfying the criteria the default response will be used.


The Body section is where you define the response Body. You are presented with the JSON editor which makes it easier for you to lint your code and visually understand the structure. You can also upload files to be served as responses

Data Generators

You can use data generator syntax in the response body to get a randomized response every time. For more details visit our section on generating data.


You can use reference syntax in the response body to access either path parameters or JSON body values. For more details visit our section on referencing data.

Base64 encoding

The last but not least you have the ability to add binary responses. You can achieve this by encoding them in base 64 with padding and using that as the response. Just know that it would be best to add appropriate headers, like content-type so that the browser knows what’s going on.