Members
# constant buildReketResponse
Creates a response with data exposed and other response attributes exposed as readonly.
This format will avoid having to access response.data
in order to get the data.
Imagine we have a HTTP with response promise as follow:
"data": {
"shi": "ming",
"foo": "bar",
"me": "zot"
},
"headers": {
...
}
To access data in the promise you have to do something like:
Reket.get('/my/url').then((response) => {
const foo = response.data.foo;
// or const { foo } = response.data;
// and then access the headers
const headers = response.headers;
});
With ReketResponse format it's possible to get directly foo from response like so:
Reket.get('/my/url').then((response) => {
const foo = response.foo;
// or const { foo } = response;
// and then access the headers
const headers = response.getHeaders;
});
Type Definitions
# ReketResponse
Represent a Reket response structure base. Non readonly attributes depend of the HTTP call.
Properties:
Name | Type | Description |
---|---|---|
getConfig |
Object | readonly property that expose the original config of the request. |
getHeaders |
Object | readonly property that expose the response headers returned by the HTTP call. |
getRequest |
Object | readonly property that expose the original request that has been send. |
getStatus |
string | readonly property that expose the response status (e.g. 200, 304, ...). |
getStatusText |
string | readonly property that expose the status text of the response (e.g. "OK", "Not Modified", ...). |
isReketResponse |
bool | readonly and internal only property. |