The value to validate
Type predicate indicating if the value is a Response object
// Valid Response object
const response = new Response('{"data": "test"}', {
headers: { 'Content-Type': 'application/json' }
});
if (isHttpResponse(response)) {
console.log('Valid HTTP response:', response.status);
}
// Invalid Response object
const invalidResponse = { status: 200 }; // Missing required properties
if (!isHttpResponse(invalidResponse)) {
console.log('Not a valid HTTP response');
}
Type guard to validate if a value is a valid HTTP Response object. Checks for the presence of essential Response properties and methods.