req.is(type)
Returns true
if the incoming request’s “Content-Type” HTTP header field matches the MIME type specified by the type
parameter. Returns false
otherwise.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | // With Content-Type: text/html; charset=utf-8 req.is( 'html' ); req.is( 'text/html' ); req.is( 'text/*' ); // => true // When Content-Type is application/json req.is( 'json' ); req.is( 'application/json' ); req.is( 'application/*' ); // => true req.is( 'html' ); // => false |
For more information, or if you have issues or concerns, see type-is.
Please login to continue.