Class $k.HttpRequest

A HTTP request

Class Summary
Constructor Attributes Constructor Name and Description
 
$k.HttpRequest(url, method, queryData)
Creates a new request

Method Summary

Class Detail

$k.HttpRequest(url, method, queryData)
Creates a new request
Parameters:
{string} url
URL
{string} method
Request method (GET, POST etc.). If undefined, GET is used
{object} queryData Optional
Query data
Throws:
{$k.exception.InvalidValue}
If the URL is invalid

Method Detail

  • {$k.Cookie[]} cookies()
    Returns the cookies as an object. The name of a property is the cookie name, the value a Cookie object
    Returns:
    {$k.Cookie[]}
  • {object} queryData()
    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:
    {object}
    See:
    $k.HttpRequest#urlQueryData
    $k.NetEntity#formData
  • 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.
    Parameters:
    {object} queryData
  • setUrl(url)
    Sets the URL
    Parameters:
    {string} url
    Throws:
    {$k.exception.InvalidValue}
    If the URL is not valid
  • {string} url()
    Returns the full URL
    Returns:
    {string}
  • {object} urlQueryData()
    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:
    {object}
    See:
    $k.HttpRequest#queryData