Class: HttpResponse

HttpResponse(response, httpClient)

Wrapper for HTTP responses.

Includes the HTTP client that performed the request and received the response and the elapsed time in milliseconds.

Constructor

new HttpResponse(response, httpClient)

Constructs new wrapper with the supplied response and client.

Parameters:
Name Type Description
response AxiosResponse

the HTTP response

httpClient HttpClient

client that performed the HTTP request

Author:
  • Mihail Radkov
Source:

Methods

getBaseURL() → {string}

Returns the base URL to which this request was performed.

Source:
Returns:

the base URL

Type
string

getData() → {string|any}

Returns the HTTP response's data.

Source:
Returns:

the response data

Type
string | any

getElapsedTime() → {number}

Returns the elapsed time of the HTTP request execution.

Source:
Returns:

the elapsed time in milliseconds

Type
number

getHeaders() → {Object}

Returns the HTTP response's headers.

Source:
Returns:

the headers map

Type
Object

setElapsedTime(elapsedTime)

Sets the elapsed time of the request and response.

Parameters:
Name Type Description
elapsedTime number

the elapsed time in milliseconds

Source: