docs: document array and multiple-args support in req.is (#2042)

This commit is contained in:
Gaurav Kesh Roushan
2025-08-23 06:49:33 +05:30
committed by GitHub
parent e52698d1ae
commit ae6197f3c1
2 changed files with 26 additions and 3 deletions

View File

@@ -21,8 +21,22 @@ req.is('application/json')
req.is('application/*')
// => 'application/*'
// Using arrays
// When Content-Type is application/json
req.is(['json', 'html'])
// => 'json'
// Using multiple arguments
// When Content-Type is application/json
req.is('json', 'html')
// => 'json'
req.is('html')
// => false
req.is(['xml', 'yaml'])
// => false
req.is('xml', 'yaml')
// => false
```
For more information, or if you have issues or concerns, see [type-is](https://github.com/expressjs/type-is).

View File

@@ -15,8 +15,17 @@ req.is('json') // => 'json'
req.is('application/json') // => 'application/json'
req.is('application/*') // => 'application/*'
req.is('html')
// => false
// Using arrays
// When Content-Type is application/json
req.is(['json', 'html']) // => 'json'
// Using multiple arguments
// When Content-Type is application/json
req.is('json', 'html') // => 'json'
req.is('html') // => false
req.is(['xml', 'yaml']) // => false
req.is('xml', 'yaml') // => false
```
For more information, or if you have issues or concerns, see [type-is](https://github.com/expressjs/type-is).