Skip to content

Commit ae6197f

Browse files
authored
docs: document array and multiple-args support in req.is (#2042)
1 parent e52698d commit ae6197f

File tree

2 files changed

+26
-3
lines changed

2 files changed

+26
-3
lines changed

_includes/api/en/4x/req-is.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,22 @@ req.is('application/json')
2121
req.is('application/*')
2222
// => 'application/*'
2323

24+
// Using arrays
25+
// When Content-Type is application/json
26+
req.is(['json', 'html'])
27+
// => 'json'
28+
29+
// Using multiple arguments
30+
// When Content-Type is application/json
31+
req.is('json', 'html')
32+
// => 'json'
33+
2434
req.is('html')
2535
// => false
36+
req.is(['xml', 'yaml'])
37+
// => false
38+
req.is('xml', 'yaml')
39+
// => false
2640
```
2741

28-
For more information, or if you have issues or concerns, see [type-is](https://github.com/expressjs/type-is).
42+
For more information, or if you have issues or concerns, see [type-is](https://github.com/expressjs/type-is).

_includes/api/en/5x/req-is.md

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,17 @@ req.is('json') // => 'json'
1515
req.is('application/json') // => 'application/json'
1616
req.is('application/*') // => 'application/*'
1717

18-
req.is('html')
19-
// => false
18+
// Using arrays
19+
// When Content-Type is application/json
20+
req.is(['json', 'html']) // => 'json'
21+
22+
// Using multiple arguments
23+
// When Content-Type is application/json
24+
req.is('json', 'html') // => 'json'
25+
26+
req.is('html') // => false
27+
req.is(['xml', 'yaml']) // => false
28+
req.is('xml', 'yaml') // => false
2029
```
2130

2231
For more information, or if you have issues or concerns, see [type-is](https://github.com/expressjs/type-is).

0 commit comments

Comments
 (0)