json()
Sets a JSON response body. Appends a Content-Type: application/json
header on the response.
Call signature
1function json(data: Record<string, any>): MockedResponse
Examples
1rest.get('/user', (req, res, ctx) => {2 return res(3 ctx.json({4 firstName: 'John',5 age: 32,6 }),7 )8})