Type guard to validate if a Response object contains JSON content. Checks both the Content-Type header and ensures it's a valid Response object.
The Response object to validate
Type predicate indicating if the response contains JSON content
// Valid JSON responseconst jsonResponse = new Response('{"data": "test"}', { headers: { 'Content-Type': 'application/json' }});assertJsonResponse(jsonResponse); Copy
// Valid JSON responseconst jsonResponse = new Response('{"data": "test"}', { headers: { 'Content-Type': 'application/json' }});assertJsonResponse(jsonResponse);
Type guard to validate if a Response object contains JSON content. Checks both the Content-Type header and ensures it's a valid Response object.