🐾 What kind of content is this request/response?
npm install @isz/content-type-isCheck the content type of a request or response in a simple way.
``ts
import { contentTypeIs } from "@isz/content-type-is";
// …
const its = contentTypeIs(response);
if (its.html) {
// Handle HTML response
} else if (its.json) {
// Handle JSON response
} else {
// Handle other response types
}
``
- html
- json
- plain
- image
- xml
- javascript
- css
- stream
- pdf
- video
- audio
- binary
- form
- multipart
