By default, the response of doApiRequest method has the status code retrieved
by the http header. Sometimes, this status code is overridden by a code in the response body.
You can use this method to map that code from body and use it to override the http status code.
A function fired, if not null, when the doApiRequest method receives a response
from the BE. This can be useful to manage broadly a http.Response the same way
for every api call.
A function fired when the http client gives a 401 response after an API call.
It is used to refresh the auth token, if set, and after returning the new token
the ConnectionManager will attempt the API call once again.
This method can be used in combination with onTokenExpired to define a custom rule
to trigger the onTokenExpired method. By default, onTokenExpired is fired when
the http response has a 401 status code. Eventually, this rule can be expanded thanks
to this method.
Specify if the error message coming from the try-catch block in doApiRequest
should be returned in the response (i.e. decoding errors). Default to true.
Call this method to add new headers to the Connection Manager to be used
for all the API calls toghether with constantHeaders passed to the constructor.