Class ResponsePromise<T, U>
Constructors
constructor
- new ResponsePromise<T, U>(url, request): ResponsePromise<T, U>
Parameters
url: string | URL
request: {
data?: any;
headers: Record<string, any>;
method: string;
}
Optional
data?: any
headers: Record<string, any>
method: string
Methods
catch
- catch(fn): Promise<any>
Parameters
fn: ((...args) => any)
- (...args): any
Returns any
Returns Promise<any>
finally
- finally(fn): Promise<Response>
Parameters
fn: ((...args) => any)
- (...args): any
Returns any
Returns Promise<Response>
getRequest
- getRequest(params?): Promise<Response>
Parameters
Optional
params: {
data?: any;
headers?: Record<string, any>;
method?: string;
}
Optional
data?: any
Optional
headers?: Record<string, any>
Optional
method?: string
Returns Promise<Response>
stream
- stream(): AsyncGenerator<U, any, any>
Returns AsyncGenerator<U, any, any>
then
- then(onSuccess, onFail): Promise<T>
Parameters
onSuccess: ((...args) => any)
- (...args): any
Returns any
onFail: ((...args) => any)
- (...args): any
Returns any
Returns Promise<T>