Http.Response

Http.Response is a value type that represents a HTTP response.

For more information on making HTTP requests, see Http.

property Bool isErrorread only

True if a network error occurred during the request and false if the request completed successfully.

Note that this is only set for errors that caused the transmission of the request itself to fail. The HTTP server may still return a status code that indicates that it experienced an problem in servicing the request, such as a 404 "Not found" code and this must be handled separately by your code.

property Url urlread only

The URL associated with the response. This will be different from the requested URL if a redirection occurred.

property String bodyread only

property Json bodyJsonread only

The response body.

This property contains a decoded version of the body content. If Zing did not recognize the text encoding used, the body property will be an empty string. You can access the raw body data and text encoding string using the rawBody and encoding properties.

If the content-type is "application/json", the bodyJson property will return a decoded JSON object.

property String rawBodyread only

property String encodingread only

The unprocessed body and body encoding values returned by the server.

This is useful for non-string bodies, or for text encodings that Zing does not recognize.

property Int statusCoderead only

property Int statusCategoryread only

The HTTP status code returned by the server. If the response has not completed, or encountered a network error, the status code will be 0.

The statusCategory is a convenience property that returns the first digit of the three digit statusCode. For example, it will be "4" for a full status code of "404" and "3" for a status code of "302".

property DateTime requestTimeread only

property DateTime responseTimeread only

The time the request was originally made, and the response received.

function cookie(String name) → String

function cookies() → Dictionary<String, String>

Return an individual cookie by name, or a dictionary of all the response's cookies.

function header(String name) → String

Get the HTTP header value. HTTP header names are case-insensitive.