Class: HttpContext
The HttpContext
It has similar properties than URL
See
https://developer.mozilla.org/en-US/docs/Web/API/URL_API
Constructors
new HttpContext(hostname, method, uri, protocol, port, headers)
new HttpContext(
hostname
,method
,uri
,protocol
,port
,headers
):HttpContext
Parameters
• hostname: string
• method: HttpMethodType
• uri: string
• protocol: "http"
| "https"
= "http"
• port: string
| number
= "80"
• headers: Object
= {}
Returns
Source
packages/core/src/utils/httpcontext.ts:59
Properties
body
body:
Buffer
|Readable
Source
packages/core/src/utils/httpcontext.ts:51
clientIp
clientIp:
string
Get the client ip if available
Source
packages/core/src/utils/httpcontext.ts:43
cookies
cookies:
any
Source
packages/core/src/utils/httpcontext.ts:52
headers
headers:
HeadersRequest
Source
packages/core/src/utils/httpcontext.ts:48
host
host:
string
Source
packages/core/src/utils/httpcontext.ts:50
hostname
hostname:
string
Hostname
Example
test.webda.io
Source
packages/core/src/utils/httpcontext.ts:31
method
method:
HttpMethodType
HTTP Method
Source
packages/core/src/utils/httpcontext.ts:35
origin
origin:
string
Source
packages/core/src/utils/httpcontext.ts:49
path
path:
string
Source
packages/core/src/utils/httpcontext.ts:44
port
port:
string
Source
packages/core/src/utils/httpcontext.ts:47
prefix
prefix:
string
=""
URI prefix in case it is exposed through something that prefix the uri
Source
packages/core/src/utils/httpcontext.ts:57
protocol
protocol:
"http:"
|"https:"
Source
packages/core/src/utils/httpcontext.ts:46
search
search:
string
Source
packages/core/src/utils/httpcontext.ts:45
uri
uri:
string
Pathname
Source
packages/core/src/utils/httpcontext.ts:39
Methods
getAbsoluteUrl()
getAbsoluteUrl(
uri
):string
Parameters
• uri: string
= undefined
to return absolute url from
Returns
string
Source
packages/core/src/utils/httpcontext.ts:362
getClientIp()
getClientIp():
string
Get the client ip
Returns
string
Source
packages/core/src/utils/httpcontext.ts:112
getCookies()
getCookies():
any
Get cookies
Returns
any
Source
packages/core/src/utils/httpcontext.ts:155
getHeader()
getHeader(
name
,def
?):string
|string
[]
Get header value