@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]: string | null | undefined
Defined in
src/http.ts:32
url
url:
null|string
Defined in
src/http.ts:33
headers
staticheaders:object={}
Index Signature
[key: string]: string | null | undefined
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()
staticaddInterceptor(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?
optionalheaders:object
Index Signature
[key: string | symbol]: string | null | undefined
interceptors?
optionalinterceptors:HttpInterceptor[]
url?
optionalurl: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]: any
Type declaration
body?
optionalbody:any
decode?
optionaldecode:boolean
fragment?
optionalfragment:string
headers?
optionalheaders:object
Index Signature
[key: string | symbol]: string | null | undefined
method?
optionalmethod:"GET"|"POST"|"PATCH"|"PUT"|"DELETE"
query?
optionalquery:object[] |object
url?
optionalurl:string
Defined in
src/http.ts:8