In Mockoon you can easily define response headers for each route but also at the environment level. Response headers defined on a route will override those defined in an environment.
To add response headers like Content-Type
to your route, go to the route's Headers tab and fill the name and value fields:
You can add one or more headers by clicking on the "Add header" button at the bottom of the list:
You can also add response headers at the environment level. Headers defined in an environment will be overridden if they are redefined on a route. To define an environment response header:
Open the Environment Headers by clicking on the tab at the top of the window:
And add one or more headers by clicking on the "Add header" button at the bottom of the list:
By default, the Connection
and Upgrade
request headers containing something else than websocket
are ignored by Mockoon and will have no effect on the response.
However, when your mock contains a WebSocket route, Mockoon will use these headers to upgrade the connection to a WebSocket connection. In this case, passing an Upgrade
header without the value websocket
will result in a 400 Bad Request response.