UNPKG

ngx-uploadx

Version:
24 lines (23 loc) 932 B
import { InjectionToken } from '@angular/core'; import { RequestOptions } from './interfaces'; export interface AjaxRequestConfig extends RequestOptions { [x: string]: any; data?: BodyInit | null; url: string; } export interface AjaxResponse<T> { data: T; status: number; headers: Record<string, string>; } export interface Ajax { request: <T = string>(config: AjaxRequestConfig) => Promise<AjaxResponse<T>>; } export declare class UploadxAjax { private buildXhr; constructor(buildXhr: () => XMLHttpRequest); request: <T = string>({ method, data, headers, url, responseType, signal, onUploadProgress, timeout, withCredentials, validateStatus }: AjaxRequestConfig) => Promise<AjaxResponse<T>>; getResponseHeaders(xhr: XMLHttpRequest): Record<string, string>; getResponseBody<T>(xhr: XMLHttpRequest, responseType?: string): T; } export declare const UPLOADX_AJAX: InjectionToken<Ajax>;