Home Manual Reference Source
import HttpResponse from 'ievv_jsbase/lib/http/HttpResponse'
public class | source

HttpResponse

HTTP response.

Wraps a XMLHttpRequest to make it easier to get information about the response from the server.

Constructor Summary

Public Constructor
public

constructor(request: *)

Member Summary

Public Members
public get

body: *

Get the response body (the responseText attribute of the XMLHttpRequest).

public

request: *

public get

status: *

Get the status code of the response (the status attribute of the XMLHttpRequest).

Method Summary

Public Methods
public

Get HttpResponse#body pretty formatted.

public

Returns true if HttpResponse#status is 400 or larger and less than 500.

public

Returns true if HttpResponse#status is 0.

public

isRedirect(): *

Returns true if HttpResponse#status is 300 or larger and less than 400.

public

Returns true if HttpResponse#status is 500 or larger.

public

isSuccess(): *

Returns true if HttpResponse#status is 200 or larger and less than 300.

public

Get the response header as string.

public

Create a HttpResponseError from this HttpResponse.

public

Format as a string suitable for debugging.

Public Constructors

public constructor(request: *) source

Params:

NameTypeAttributeDescription
request *

A XMLHttpRequest object.

Public Members

public get body: * source

Get the response body (the responseText attribute of the XMLHttpRequest).

public request: * source

public get status: * source

Get the status code of the response (the status attribute of the XMLHttpRequest).

Public Methods

public getPrettyfiedBody(): * source

Get HttpResponse#body pretty formatted.

By default, this just returns HttpResponse#body but subclasses can override this to prettify the body if they know the output format of the body.

Return:

*

public isClientError(): * source

Returns true if HttpResponse#status is 400 or larger and less than 500.

Return:

*

public isConnectionRefused(): * source

Returns true if HttpResponse#status is 0. Assuming the XMLHttpRequest was actually sent, this means that the connection was refused.

Return:

*

public isRedirect(): * source

Returns true if HttpResponse#status is 300 or larger and less than 400.

Return:

*

public isServerError(): * source

Returns true if HttpResponse#status is 500 or larger.

Return:

*

public isSuccess(): * source

Returns true if HttpResponse#status is 200 or larger and less than 300.

Return:

*

public responseHeaderToString(): string source

Get the response header as string.

Return:

string

public toError(): HttpResponseError source

Create a HttpResponseError from this HttpResponse.

Return:

HttpResponseError

An HttpResponseError with this HttpResponse as the response property.

public toString(): string source

Format as a string suitable for debugging.

Return:

string