![]() |
Murl Engine Lua Addon API
Version 1.0 beta
|
The url request interface.
The IUrlRequest object can be created by the IWebControl object.
Define custom HTTP headers for the request. This method can be used to define any number of custom HTTP headers sent with the URL request, given as a map containing string key/value pairs for the header names and values, respectively. Note: When using a POST request, the given headers should not include the "Content-Type" and "Content-Length" headers, as they are automatically added during SendPost().
Boolean SetHeaders(Murl.Map.StringString headers)
headers | The map of header key/value pairs. |
Clear any custom HTTP headers for the request.
Boolean ClearHeaders()
Send a url-request with http method GET. When posting a url-request the IsPending() state is true. If the url-request was successful the WasFinished() state is true and the response data can be accessed by GetResponseData().
Boolean SendGet(String url, Number timeout)
url | The url string to send to. |
timeout | The request timeout in seconds. |
Send a url-request with http method POST. When posting a url-request the IsPending() state is true. If the url-request was successful the WasFinished() state is true and the response data can be accessed by GetResponseData().
If the url is redirected, the POST is cancelled and WasRejected() state is true.
Boolean SendPost(String url, Murl.Data body, String contentType, Number timeout)
url | The url string to send to. |
body | The body data to send. |
contentType | The string for the "Content-Type" http header field. |
timeout | The request timeout in seconds. |
Get the custom HTTP headers defined for this request.
Murl.Map.StringString GetHeaders()
Get the url-request string.
String GetUrlString()
Get the url-request response data. The data is available if WasFinished() returns true.
Murl.Data GetResponseData()
Get the HTTP headers received with this URL request's response. The headers are available if WasFinished() returns true.
Murl.Map.StringString GetResponseHeaders()
Get the current response data size. The size is updated while receiving data asynchronous.
Integer GetCurrentDataSize()
Release the response data. Releasing the data can be performed only if the url-request is not pending.
Boolean ReleaseData()
Check if the url-request is pending.
Boolean IsPending()
Check if the url-request was finished in the most recent tick.
Boolean WasFinished()
Check if the url-request was rejected in the most recent tick.
Boolean WasRejected()