class com.akifox.asynchttp.HttpResponse

Available on all platforms

HttpRequest

This class represents an Http Request

NOTE: You don't need to use this class! It is the HttpResponse object that will be passed to an HttpRequest callback

@author Simone Cingano (yupswing) Akifox Studio

@repo akifox-asynchttp repository

@licence MIT Licence

Instance Fields

var content:Dynamic

Response content (Bytes or String based on the mime-type)

var contentIsBinary:Bool

Response content binary flag (based on the contentType)

var contentLength:Int

Response content length

var contentRaw:Bytes

Response content (Bytes)

var contentType:String

Response content mime-type

NOTE: Always application/octet-stream in FLASH

NOTE: Always text/plain in JAVASCRIPT

var error:String

var filename:String

The resource filename (default: "unknown")

NOTE: This is a guessed resource filename based on the final retrived url

Example:

URL: http://example.com/download/filename.zip?dl=1

Filename: filename.zip

var fingerprint:String

Fingerprint

NOTE: Same as instance.request.fingerprint

var headers:HttpHeaders

Response HTTP headers

var isBinary:Bool

Tells if the content is Binary data (based on contentType)

var isImage:Bool

Tells if the content is Image data (based on contentType)

var isJson:Bool

Tells if the content is Json data (based on contentType)

var isOK:Bool

A good response

true if the status is >=200 and <400

var isText:Bool

Tells if the content is Text data (based on contentType)

var isXml:Bool

Tells if the content is Xml data (based on contentType)

var request:HttpRequest

The request

NOTE: This gives access to the original request (immutable because already sent)

var status:Int

Response HTTP status

NOTE: set to 0 if connection error occurs

var time:Float

Time elapsed from the request start to the end of the response (in seconds)

var url:URL

Final URL retrived

var urlString:String

Final URL retrived (string format)

DEPRECATED: This is deprecated, use instance.url.toString() instead

function new(request:HttpRequest, time:Float, url:URL, headers:HttpHeaders, status:Int, content:Bytes, ?error:String):Void

Class instance

NOTE: YOU DON'T NEED TO MAKE AN INSTANCE OF THE RESPONSE, IT IS HANDLED INTERNALLY BY THE LIBRARY

The instance is anyway allowed for third party uses of the library * * @param request original request

time

the response time

url

the final url retrived (could be different from the requested URL because of redirects)

headers

the response headers

status

the response status (0 if error otherwise HTTP standard response code)

content

the response content

error

the internal error message (optional)

function toJson():Dynamic

Parse the content as Json

returns

an Anonymous Structure

function toString():String

returns

Debug representation of the HttpResponse instance

function toText():String

Gives the content in String format

returns

a String

function toXml():Xml

Parse the content as XML

returns

an Xml instance