Class: HttpRequest

$k. HttpRequest

new $k.HttpRequest(url, method, queryData)

Creates a new request

Name Type Description
url string

HTTP(S) URL

method string

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

cookies() : Array.<$k.Cookie>

Returns the cookies as an object. The name of a property is the cookie name, the value a Cookie object

Returns:
Type Description
Array.<$k.Cookie>

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

See:
Returns:
Type Description
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

See:
Returns:
Type Description
object

Intherited methods