UNPKG

@lukesthl/ts-axios-digest-auth

Version:

A library which implements HTTP digest authentication for axios clients. With generic typescript support

31 lines (28 loc) 1.17 kB
import { AxiosInstance, AxiosRequestConfig, AxiosResponse } from 'axios'; /** * Options to configure the AxiosDigestAuth instance. */ interface AxiosDigestAuthOptions { /** * optionally provide your own axios instance. */ axios?: AxiosInstance; /** the http digest auth password */ password: string; /** the http digest auth username */ username: string; } declare class AxiosDigestAuth { private readonly axios; private count; private readonly password; private readonly username; constructor({ axios: axiosInst, password, username, }: AxiosDigestAuthOptions); private authError; get<T>(url: string, config?: AxiosRequestConfig<T>): Promise<AxiosResponse<T, unknown>>; post<T>(url: string, data: T, config?: AxiosRequestConfig<T>): Promise<AxiosResponse<T, unknown>>; put<T>(url: string, data: T, config?: AxiosRequestConfig<T>): Promise<AxiosResponse<T, unknown>>; delete<T>(url: string, config?: AxiosRequestConfig<T>): Promise<AxiosResponse<T, unknown>>; request<T>(opts: AxiosRequestConfig): Promise<AxiosResponse<T, unknown>>; } export { AxiosDigestAuth, AxiosDigestAuthOptions };