/*! * Copyright (c) 2020 Ville de Montreal. All rights reserved. * Licensed under the MIT license. * See LICENSE file in the project root for full license information. */ import { HttpClientError, IHttpClient, IHttpDefaults, IHttpRequest, IHttpResponse, ILogger, IHttpContext } from '@villedemontreal/auth-core'; import * as http from 'http'; import { AxiosResponseHeaders, RawAxiosResponseHeaders } from 'axios'; /** * An implementation of the IHttpClient using the Axios library */ export declare class AxiosHttpClient implements IHttpClient { private logger; private defaults; constructor(logger: ILogger, defaults?: IHttpDefaults); /** * Sends a HTTP request to a remote server * @param request the HTTP request to send to a remote server * @returns a HTTP response from the server * @throws HttpClientError when response status code is not within 200 to 299 range, * or for any other exception. */ send(request: Readonly): Promise; private doSend; private createRequestContext; private createRequestContent; private processResponse; } export declare function convertHeaders(headers: RawAxiosResponseHeaders | AxiosResponseHeaders): http.IncomingHttpHeaders; /** * remaps an error thrown while sending a request into a HttpClientError * @param err the error thrown while sending the request * @param context the current context * @returns a HttpClientError */ export declare function remapError(err: any, context: IHttpContext): HttpClientError;