@itwin/imodels-client-management
Version:
iModels API client wrapper for applications that manage iModels.
24 lines • 1.04 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.AxiosResponseHeadersAdapter = void 0;
/** Default implementation for {@link HttpResponseHeaders} interface, which adapts `axios` HTTP response headers to headers expected by the iModels Client. */
class AxiosResponseHeadersAdapter {
_response;
constructor(response) {
this._response = response;
}
get(headerName) {
// Directly manipulating headers object is deprecated.
// https://github.com/axios/axios?tab=readme-ov-file#-axiosheaders
if (this._response.headers.get instanceof Function)
return this._response.headers.get(headerName);
// It's most likely that header name is lowercase.
// https://axios-http.com/docs/res_schema
return this._response.headers[headerName.toLowerCase()];
}
getAll() {
return this._response.headers;
}
}
exports.AxiosResponseHeadersAdapter = AxiosResponseHeadersAdapter;
//# sourceMappingURL=AxiosResponseHeadersAdapter.js.map