Extends
- http.IncomingMessage
Members
charset
- Source:
Returns the default charset for the current URL.
Example
request.charset // returns 'UTF-8'
contentType
- Source:
Returns the default content type for the current URL.
Example
request.contentType // returns 'application/javascript; charset=utf-8'
mimeType
- Source:
Returns the default mime type for the current URL.
Example
request.mimeType // returns 'application/javascript'
Methods
includes(pattern) → {Boolean}
- Source:
Returns whether the current request matches a particular pattern.
Examples
request.includes('**.js')
request.includes(/\.js$/)
request.includes({ path: '**.js' })
request.includes({ path: /\.js$/ })
request.includes('GET|POST:80|443 **.js')
request.includes({ method: 'GET|POST', port: '80|443', path: '**.js' })
request.includes({ method: ['GET', 'POST'], port: [80, 443], path: /\.js$/ })
Parameters:
Name | Type | Description |
---|---|---|
pattern |
Object | String | RegExp | The pattern used to match the current request. |
Returns:
Whether the pattern matched the current request.
- Type
- Boolean