nextjs-koa-api / Koa / BaseRequest
Koa.BaseRequest
- URL
- charset
- fresh
- header
- headers
- host
- hostname
- href
- idempotent
- ip
- ips
- length
- method
- origin
- path
- protocol
- query
- querystring
- search
- secure
- socket
- stale
- subdomains
- type
- url
• URL: URL
Get WHATWG parsed URL object.
ContextDelegatedRequest.URL
node_modules/.pnpm/@types+koa@2.13.4/node_modules/@types/koa/index.d.ts:113
• charset: string
Get the charset when present or undefined.
node_modules/.pnpm/@types+koa@2.13.4/node_modules/@types/koa/index.d.ts:566
• fresh: boolean
Check if the request is fresh, aka Last-Modified and/or the ETag still match.
ContextDelegatedRequest.fresh
node_modules/.pnpm/@types+koa@2.13.4/node_modules/@types/koa/index.d.ts:120
• header: IncomingHttpHeaders
Return request header.
ContextDelegatedRequest.header
node_modules/.pnpm/@types+koa@2.13.4/node_modules/@types/koa/index.d.ts:43
• headers: IncomingHttpHeaders
Return request header, alias as request.header
ContextDelegatedRequest.headers
node_modules/.pnpm/@types+koa@2.13.4/node_modules/@types/koa/index.d.ts:48
• host: string
Parse the "Host" header field host and support X-Forwarded-Host when a proxy is enabled.
ContextDelegatedRequest.host
node_modules/.pnpm/@types+koa@2.13.4/node_modules/@types/koa/index.d.ts:101
• hostname: string
Parse the "Host" header field hostname and support X-Forwarded-Host when a proxy is enabled.
ContextDelegatedRequest.hostname
node_modules/.pnpm/@types+koa@2.13.4/node_modules/@types/koa/index.d.ts:108
• href: string
Get full request URL.
ContextDelegatedRequest.href
node_modules/.pnpm/@types+koa@2.13.4/node_modules/@types/koa/index.d.ts:63
• idempotent: boolean
Check if the request is idempotent.
ContextDelegatedRequest.idempotent
node_modules/.pnpm/@types+koa@2.13.4/node_modules/@types/koa/index.d.ts:132
• ip: string
Request remote address. Supports X-Forwarded-For when app.proxy is true.
ContextDelegatedRequest.ip
node_modules/.pnpm/@types+koa@2.13.4/node_modules/@types/koa/index.d.ts:159
• ips: string
[]
When app.proxy
is true
, parse
the "X-Forwarded-For" ip address list.
For example if the value were "client, proxy1, proxy2"
you would receive the array ["client", "proxy1", "proxy2"]
where "proxy2" is the furthest down-stream.
ContextDelegatedRequest.ips
node_modules/.pnpm/@types+koa@2.13.4/node_modules/@types/koa/index.d.ts:169
• length: number
Return parsed Content-Length when present.
node_modules/.pnpm/@types+koa@2.13.4/node_modules/@types/koa/index.d.ts:571
• method: string
Get/Set request method.
ContextDelegatedRequest.method
node_modules/.pnpm/@types+koa@2.13.4/node_modules/@types/koa/index.d.ts:68
• origin: string
Get origin of URL.
ContextDelegatedRequest.origin
node_modules/.pnpm/@types+koa@2.13.4/node_modules/@types/koa/index.d.ts:58
• path: string
Get request pathname. Set pathname, retaining the query-string when present.
ContextDelegatedRequest.path
node_modules/.pnpm/@types+koa@2.13.4/node_modules/@types/koa/index.d.ts:74
• protocol: string
Return the protocol string "http" or "https" when requested with TLS. When the proxy setting is enabled the "X-Forwarded-Proto" header field will be trusted. If you're running behind a reverse proxy that supplies https for you this may be enabled.
ContextDelegatedRequest.protocol
node_modules/.pnpm/@types+koa@2.13.4/node_modules/@types/koa/index.d.ts:147
• query: ParsedUrlQuery
Get parsed query-string. Set query-string as an object.
ContextDelegatedRequest.query
node_modules/.pnpm/@types+koa@2.13.4/node_modules/@types/koa/index.d.ts:80
• querystring: string
Get/Set query string.
ContextDelegatedRequest.querystring
node_modules/.pnpm/@types+koa@2.13.4/node_modules/@types/koa/index.d.ts:85
• search: string
Get the search string. Same as the querystring except it includes the leading ?.
Set the search string. Same as response.querystring= but included for ubiquity.
ContextDelegatedRequest.search
node_modules/.pnpm/@types+koa@2.13.4/node_modules/@types/koa/index.d.ts:94
• secure: boolean
Short-hand for:
this.protocol == 'https'
ContextDelegatedRequest.secure
node_modules/.pnpm/@types+koa@2.13.4/node_modules/@types/koa/index.d.ts:154
• socket: Socket
Return the request socket.
ContextDelegatedRequest.socket
node_modules/.pnpm/@types+koa@2.13.4/node_modules/@types/koa/index.d.ts:137
• stale: boolean
Check if the request is stale, aka "Last-Modified" and / or the "ETag" for the resource has changed.
ContextDelegatedRequest.stale
node_modules/.pnpm/@types+koa@2.13.4/node_modules/@types/koa/index.d.ts:127
• subdomains: string
[]
Return subdomains as an array.
Subdomains are the dot-separated parts of the host before the main domain
of the app. By default, the domain of the app is assumed to be the last two
parts of the host. This can be changed by setting app.subdomainOffset
.
For example, if the domain is "tobi.ferrets.example.com":
If app.subdomainOffset
is not set, this.subdomains is
["ferrets", "tobi"]
.
If app.subdomainOffset
is 3, this.subdomains is ["tobi"]
.
ContextDelegatedRequest.subdomains
node_modules/.pnpm/@types+koa@2.13.4/node_modules/@types/koa/index.d.ts:183
• type: string
Return the request mime type void of parameters such as "charset".
node_modules/.pnpm/@types+koa@2.13.4/node_modules/@types/koa/index.d.ts:577
• url: string
Get/Set request URL.
ContextDelegatedRequest.url
node_modules/.pnpm/@types+koa@2.13.4/node_modules/@types/koa/index.d.ts:53
▸ accepts(): string
[]
Check if the given type(s)
is acceptable, returning
the best match when true, otherwise false
, in which
case you should respond with 406 "Not Acceptable".
The type
value may be a single mime type string
such as "application/json", the extension name
such as "json" or an array ["json", "html", "text/plain"]
. When a list
or array is given the best match, if any is returned.
Examples:
// Accept: text/html
this.accepts('html');
// => "html"
// Accept: text/*, application/json
this.accepts('html');
// => "html"
this.accepts('text/html');
// => "text/html"
this.accepts('json', 'text');
// => "json"
this.accepts('application/json');
// => "application/json"
// Accept: text/*, application/json
this.accepts('image/png');
this.accepts('png');
// => undefined
// Accept: text/*;q=.5, application/json
this.accepts(['html', 'json']);
this.accepts('html', 'json');
// => "json"
string
[]
ContextDelegatedRequest.accepts
node_modules/.pnpm/@types+koa@2.13.4/node_modules/@types/koa/index.d.ts:221
▸ accepts(...types
): string
| false
Name | Type |
---|---|
...types |
string [] |
string
| false
ContextDelegatedRequest.accepts
node_modules/.pnpm/@types+koa@2.13.4/node_modules/@types/koa/index.d.ts:222
▸ accepts(types
): string
| false
Name | Type |
---|---|
types |
string [] |
string
| false
ContextDelegatedRequest.accepts
node_modules/.pnpm/@types+koa@2.13.4/node_modules/@types/koa/index.d.ts:223
▸ acceptsCharsets(): string
[]
Return accepted charsets or best fit based on charsets
.
Given Accept-Charset: utf-8, iso-8859-1;q=0.2, utf-7;q=0.5
an array sorted by quality is returned:
['utf-8', 'utf-7', 'iso-8859-1']
string
[]
ContextDelegatedRequest.acceptsCharsets
node_modules/.pnpm/@types+koa@2.13.4/node_modules/@types/koa/index.d.ts:245
▸ acceptsCharsets(...charsets
): string
| false
Name | Type |
---|---|
...charsets |
string [] |
string
| false
ContextDelegatedRequest.acceptsCharsets
node_modules/.pnpm/@types+koa@2.13.4/node_modules/@types/koa/index.d.ts:246
▸ acceptsCharsets(charsets
): string
| false
Name | Type |
---|---|
charsets |
string [] |
string
| false
ContextDelegatedRequest.acceptsCharsets
node_modules/.pnpm/@types+koa@2.13.4/node_modules/@types/koa/index.d.ts:247
▸ acceptsEncodings(): string
[]
Return accepted encodings or best fit based on encodings
.
Given Accept-Encoding: gzip, deflate
an array sorted by quality is returned:
['gzip', 'deflate']
string
[]
ContextDelegatedRequest.acceptsEncodings
node_modules/.pnpm/@types+koa@2.13.4/node_modules/@types/koa/index.d.ts:233
▸ acceptsEncodings(...encodings
): string
| false
Name | Type |
---|---|
...encodings |
string [] |
string
| false
ContextDelegatedRequest.acceptsEncodings
node_modules/.pnpm/@types+koa@2.13.4/node_modules/@types/koa/index.d.ts:234
▸ acceptsEncodings(encodings
): string
| false
Name | Type |
---|---|
encodings |
string [] |
string
| false
ContextDelegatedRequest.acceptsEncodings
node_modules/.pnpm/@types+koa@2.13.4/node_modules/@types/koa/index.d.ts:235
▸ acceptsLanguages(): string
[]
Return accepted languages or best fit based on langs
.
Given Accept-Language: en;q=0.8, es, pt
an array sorted by quality is returned:
['es', 'pt', 'en']
string
[]
ContextDelegatedRequest.acceptsLanguages
node_modules/.pnpm/@types+koa@2.13.4/node_modules/@types/koa/index.d.ts:257
▸ acceptsLanguages(...langs
): string
| false
Name | Type |
---|---|
...langs |
string [] |
string
| false
ContextDelegatedRequest.acceptsLanguages
node_modules/.pnpm/@types+koa@2.13.4/node_modules/@types/koa/index.d.ts:258
▸ acceptsLanguages(langs
): string
| false
Name | Type |
---|---|
langs |
string [] |
string
| false
ContextDelegatedRequest.acceptsLanguages
node_modules/.pnpm/@types+koa@2.13.4/node_modules/@types/koa/index.d.ts:259
▸ get(field
): string
Return request header. If the header is not set, will return an empty string.
The Referrer
header field is special-cased, both Referrer
and
Referer
are interchangeable.
Examples:
this.get('Content-Type');
// => "text/plain"
this.get('content-type');
// => "text/plain"
this.get('Something');
// => ''
Name | Type |
---|---|
field |
string |
string
ContextDelegatedRequest.get
node_modules/.pnpm/@types+koa@2.13.4/node_modules/@types/koa/index.d.ts:304
▸ inspect(): any
Inspect implementation.
any
node_modules/.pnpm/@types+koa@2.13.4/node_modules/@types/koa/index.d.ts:582
▸ is(...types
): null
| string
| false
Check if the incoming request contains the "Content-Type"
header field, and it contains any of the give mime type
s.
If there is no request body, null
is returned.
If there is no content type, false
is returned.
Otherwise, it returns the first type
that matches.
Examples:
// With Content-Type: text/html; charset=utf-8
this.is('html'); // => 'html'
this.is('text/html'); // => 'text/html'
this.is('text/*', 'application/json'); // => 'text/html'
// When Content-Type is application/json
this.is('json', 'urlencoded'); // => 'json'
this.is('application/json'); // => 'application/json'
this.is('html', 'application/*'); // => 'application/json'
this.is('html'); // => false
Name | Type |
---|---|
...types |
string [] |
null
| string
| false
ContextDelegatedRequest.is
node_modules/.pnpm/@types+koa@2.13.4/node_modules/@types/koa/index.d.ts:283
▸ is(types
): null
| string
| false
Name | Type |
---|---|
types |
string [] |
null
| string
| false
ContextDelegatedRequest.is
node_modules/.pnpm/@types+koa@2.13.4/node_modules/@types/koa/index.d.ts:284
▸ toJSON(): any
Return JSON representation.
any
node_modules/.pnpm/@types+koa@2.13.4/node_modules/@types/koa/index.d.ts:587