assertResponseStatus
Assert that a Response has a specific HTTP status code, with type narrowing.
Pass describeResponse() as the third argument to include the response metadata and body in the failure message.
import { assertResponseStatus, describeResponse } from "@kensio/smartass";
const response = await fetch("https://example.com");
assertResponseStatus( response, 200, await describeResponse(response),);
// response.status is now narrowed to 200Source
Section titled “Source”Source file: src/assert/response-status/response-status.assert.ts
