class com.akifox.asynchttp.HttpRequest
Available on all platforms
HttpRequest
This class represents an Http Request
@author Simone Cingano (yupswing) Akifox Studio
@repo akifox-asynchttp repository
@licence MIT Licence
Instance Fields
var async(get,set):Bool
Asynchronous (default is true)
NOTE: When async==true the application execution will be hold until the request is completed
NOTE: Always true in FLASH due to platform limitations
var callback(get,set):HttpResponse -> Void
The callback function to be called when the response returns
NOTE: This will be called always if no callbackError is set
Otherwise it will be called only if the response is valid
var callbackError(get,set):HttpResponse -> Void
The callback error (optional) function to be called when the response returns an error
NOTE: This will be called only if set and in error case
function clone():HttpRequest
Deep copy of the HttpRequest
NOTE: The copy will be always mutable despite of the master status
| Returns: | A new HttpRequest |
|---|
var content(get,set):Dynamic
The HTTP Content
NOTE: You could provide a Bytes or a String according to the Content-type (Binary or Text)
var contentIsBinary(get,set):Bool
Content binary flag (tells if the content binary or text)
NOTE: This is set automatically when a content-type is set
var contentType(get,set):String
The HTTP Content-Type (default: application/x-www-form-urlencoded)
Content-Type list: (http://www.iana.org/assignments/media-types/media-types.xhtml)
function finalise():Void
Make this instance immutable
NOTE: This method is called automatically once this HttpRequest instance is sent
var finalised(get,null):Bool
Tell if the instance is immutable
NOTE: The only way to change an immutable instance is copying it (instance.clone()) and change the copy
var fingerprint(get,null):String
The fingerprint is a unique 8 char key which identify this request instance
var http11(get,set):Bool
Http Protocol Version flag
Tells if enable HTTP/1.1 (true
var method(get,set):String
The HTTP Method
Accepted values are HttpMethod.GET, .POST, .PUT, .DELETE
NOTE: On JAVASCRIPT only GET and POST are functional due to platform limitations
function new(options:HttpRequestOptions = null):Void
Class instance
| Parameters: | |
|---|---|
| options | HttpRequestOptions object or null (NOTE: every parameter could be changed also after the class instance) |
function send():Void
Send the request and call the callback when it is done
NOTE: When async==true the application execution will be hold until the request is completed
NOTE: When a HttpRequest is sent the instance is made immutable (you have to clone it to send again the same request)
var timeout(get,set):Int
The request timeout in seconds (default:10)
If the request receive no answer for more than the timeout it aborts