new $k.HttpRequest(url, method, queryData)
Creates a new request
Name | Type | Description |
---|---|---|
url |
string |
HTTP(S) URL |
method |
string |
optional
Request method (GET, POST etc.). If undefined, GET is used |
queryData |
object |
optional
Query data |
Throws:
Type | Description |
---|---|
$k.exception.InvalidValue | If the URL is invalid A HTTP request |
Extends
Methods
static$k.HttpRequest.current() : $k.HttpRequest
Returns the current incoming HttpRequest, or undefined if no request is active
Only supported in the following application environment(s): rest- Since:
- 5.4.0
Returns:
Type | Description |
---|---|
$k.HttpRequest |
static$k.HttpRequest.fromEncodedURL(url, method, queryData)
Creates a new request. THe URL must be already URL-encoded by the sender
Name | Type | Description |
---|---|---|
url |
string |
HTTP(S) URL |
method |
string |
optional
Request method (GET, POST etc.). If undefined, GET is used |
queryData |
object |
optional
Query data |
- Version:
- Experimental feature, might be removed at any time
- Since:
- 5.3.2
Throws:
Type | Description |
---|---|
$k.exception.InvalidValue | If the URL is invalid |
cookies() : object
Returns the cookies as an object. The name of a property is the cookie name
Returns:
Type | Description |
---|---|
object |
method() : string
Returns the requests HTTP method
Returns:
Type | Description |
---|---|
string | HTTP method value of this request |
queryData() : object
Returns the query data of the request as an object.
If the request method is GET, then this is equivalent to urlQueryData().
For other methods it returns application/x-www-form-urlencoded key/value pairs
Returns:
Type | Description |
---|---|
object |
setFormData(formData)
Sets the url-encoded form data of the request
Name | Type | Description |
---|---|---|
formData |
object |
setQueryData(queryData)
Sets the query data of the URI.
Each property is added as a query parameter (key=value).
If the value of a property is an arry, then a key=value pair is added for each array element.
Name | Type | Description |
---|---|---|
queryData |
object |
setUrl(url)
Sets the URL
Name | Type | Description |
---|---|---|
url |
string |
Throws:
Type | Description |
---|---|
$k.exception.InvalidValue | If the URL is not valid |
url() : string
Returns the full URL
Returns:
Type | Description |
---|---|
string |
urlQueryData() : object
Returns the URL query data of the URI as an object.
Each key=value pair is added as a property.
If a key appears more than once, then the value is an array with all elements
Returns:
Type | Description |
---|---|
object |