Détail du package

@isz/wants

omrilotan170UNLICENSE0.0.1

🐾 What does the request want?

accepts, content-type, mime, type-checking

readme

@isz/wants

Check what a request wants in a simple way.

import { wants } from "@isz/wants";
// …
const itWants = wants(response);

if (itWants.html) {
    // Handle HTML request
} else if (itWants.json) {
    // Handle JSON request
} else {
    // Handle other requests
}

Supported getters

  • any
  • css
  • html
  • image
  • json
  • grpc
  • stream
  • xml