@ztimson/utils / http
http
Classes
Http
Constructors
new Http()
new Http(
defaults
):Http
Parameters
• defaults: HttpDefaults
= {}
Returns
Defined in
src/http.ts:35
Properties
headers
headers:
object
={}
Index Signature
[`key`: `string
Defined in
src/http.ts:32
url
url:
null
|string
Defined in
src/http.ts:33
headers
static
headers:object
={}
Index Signature
[`key`: `string
Defined in
src/http.ts:28
Methods
addInterceptor()
addInterceptor(
fn
): () =>void
Parameters
• fn: HttpInterceptor
Returns
Function
Returns
void
Defined in
src/http.ts:49
request()
request<
T
>(opts
):PromiseProgress
<DecodedResponse
<T
>>
Type Parameters
• T
Parameters
• opts: HttpRequestOptions
= {}
Returns
PromiseProgress
<DecodedResponse
<T
>>
Defined in
src/http.ts:55
addInterceptor()
static
addInterceptor(fn
): () =>void
Parameters
• fn: HttpInterceptor
Returns
Function
Returns
void
Defined in
src/http.ts:43
Type Aliases
DecodedResponse<T>
DecodedResponse<
T
>:Response
&object
Type declaration
data
data:
T
|null
Type Parameters
• T
Defined in
src/http.ts:4
HttpDefaults
HttpDefaults:
object
Type declaration
headers?
optional
headers:object
Index Signature
[`key`: `string` \| `symbol
interceptors?
optional
interceptors:HttpInterceptor
[]
url?
optional
url:string
Defined in
src/http.ts:19
HttpInterceptor()
HttpInterceptor: (
response
,next
) =>void
Parameters
• response: Response
• next
Returns
void
Defined in
src/http.ts:6
HttpRequestOptions
HttpRequestOptions:
object
Index Signature
[`key`: `string
Type declaration
body?
optional
body:any
decode?
optional
decode:boolean
fragment?
optional
fragment:string
headers?
optional
headers:object
Index Signature
[`key`: `string` \| `symbol
method?
optional
method:"GET"
|"POST"
|"PATCH"
|"PUT"
|"DELETE"
query?
optional
query:object
[] |object
url?
optional
url:string
Defined in
src/http.ts:8