HttpResponse

com.akifox.asynchttp.HttpResponse (Class)

##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 Members

isBinary: Bool

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


isText: Bool

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


isXml: Bool

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


isJson: Bool

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


isImage: Bool

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


request: HttpRequest

The request

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


fingerprint: String

Fingerprint

NOTE: Same as instance.request.fingerprint


url: URL

Final URL retrived


urlString: String

Final URL retrived (string format)

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


headers: HttpHeaders

Response HTTP headers


status: Int

Response HTTP status

NOTE: set to 0 if connection error occurs


content: Dynamic

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


contentRaw: haxe.io.Bytes

Response content (Bytes)


contentType: String

Response content mime-type

NOTE: Always application/octet-stream in FLASH

NOTE: Always text/plain in JAVASCRIPT


contentIsBinary: Bool

Response content binary flag (based on the contentType)


contentLength: Int

Response content length


time: Float

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


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


isOK: Bool

A good response

true if the status is >=200 and <400


error: String

toString(): String
Returns
String

toXml(): Xml

Parse the content as XML

Returns
Xml

toJson(): Dynamic

Parse the content as Json

Returns
Dynamic

toText(): String

Gives the content in String format

Returns
String

new(request: HttpRequest, time: Float, url: URL, headers: HttpHeaders, status: Int, content: haxe.io.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

Name Type Default Description
request HttpRequest original request
time Float the response time
url URL the final url retrived (could be different from the requested URL because of redirects)
headers HttpHeaders the response headers
status Int the response status (0 if error otherwise HTTP standard response code)
content haxe.io.Bytes the response content
error String (optional) the internal error message (optional)

Private Members