Closed Caellian closed 8 months ago
The documentation is not very clear about this, but you can pass headers as a third argument to the reply method
mock.onGet("/users").reply(
200,
{
users: [{ id: 1, name: "John Smith" }],
},
{ "Content-Type": "application/json" },
);
Hope this helps.
That seems to be what I wanted to do at the time.
In order to mock auth route I need to provide a custom header in the reponse that's returned by the server.
As far as I can tell, only body of the response can be specified neither documentation gives details on this nor have I been able to figure it out by looking at the sources.
If it's already supported could you provide an example of modifying response headers?