mirror of
https://github.com/expressjs/expressjs.com.git
synced 2026-02-21 19:41:33 +00:00
docs: document array and multiple-args support in req.is (#2042)
This commit is contained in:
committed by
GitHub
parent
e52698d1ae
commit
ae6197f3c1
@@ -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).
|
||||
For more information, or if you have issues or concerns, see [type-is](https://github.com/expressjs/type-is).
|
||||
@@ -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).
|
||||
|
||||
Reference in New Issue
Block a user