Skip to content

Repository files navigation

@ts-stack/type-is

Infer the content-type of a request by headers. This is a fork of type-is, but this one accepts headers instead of a request object. Writen in TypeScript in format ESM.

Install

npm install @ts-stack/type-is

Usage

importhttpfrom'http';import{typeIs}from'@ts-stack/type-is';http.createServer(function(req,res){constistext=typeIs(req.headers,['text/*'])res.end('you '+(istext ? 'sent' : 'did not send')+' me text')})

License

MIT

About

A fork of the widely used `type-is` library, but this one accepts headers instead of a request object.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages

Generated from ts-stack/starter