UNPKG

1.7 kBTypeScriptView Raw
1/// <reference types="node" />
2import { HttpHandlerOptions } from '@aws-sdk/types';
3import { HttpHandler, HttpRequest, HttpResponse } from '@aws-sdk/protocol-http';
4import { CancelTokenSource, AxiosRequestHeaders, AxiosRequestTransformer } from 'axios';
5import { FetchHttpHandlerOptions } from '@aws-sdk/fetch-http-handler';
6import * as events from 'events';
7/**
8Extending the axios interface here to make headers required, (previously,
9they were not required on the type we were using, but our implementation
10does not currently account for missing headers. This worked previously,
11because the previous `headers` type was `any`.
12*/
13interface AxiosTransformer extends Partial<AxiosRequestTransformer> {
14 (data: any, headers: AxiosRequestHeaders): any;
15}
16export declare const SEND_UPLOAD_PROGRESS_EVENT = "sendUploadProgress";
17export declare const SEND_DOWNLOAD_PROGRESS_EVENT = "sendDownloadProgress";
18export declare type ErrorWithResponse = {
19 response: {
20 status: number;
21 } & {
22 [key: string]: any;
23 };
24};
25export declare const reactNativeRequestTransformer: AxiosTransformer[];
26export declare type AxiosHttpHandlerOptions = HttpHandlerOptions & {
27 cancelTokenSource?: CancelTokenSource;
28 emitter?: events.EventEmitter;
29};
30export declare class AxiosHttpHandler implements HttpHandler {
31 private readonly httpOptions;
32 private readonly emitter?;
33 private readonly cancelTokenSource?;
34 constructor(httpOptions?: FetchHttpHandlerOptions, emitter?: events.EventEmitter, cancelTokenSource?: CancelTokenSource);
35 destroy(): void;
36 handle(request: HttpRequest, options: AxiosHttpHandlerOptions): Promise<{
37 response: HttpResponse;
38 }>;
39}
40export {};