@univerjs/network v0.4.2 • Docs
Class: HTTPService
This service provides http request methods and allows to register http interceptors.
You can use interceptors to:
- modify requests (headers included) before they are sent, or modify responses before they are returned to the caller.
- threshold, logging, caching, etc.
- authentication, authorization, etc.
Extends
Constructors
new HTTPService()
new HTTPService(_http): HTTPService
Parameters
Parameter | Type |
---|---|
_http | IHTTPImplementation |
Returns
Overrides
Defined in
packages/network/src/services/http/http.service.ts:81 (opens in a new tab)
Properties
Property | Modifier | Type | Default value | Inherited from | Defined in |
---|---|---|---|---|---|
_disposed | protected | boolean | false | Disposable ._disposed | packages/core/src/shared/lifecycle.ts:93 (opens in a new tab) |
Methods
delete()
delete<T>(url, params?): Promise<HTTPEvent<T>>
Type Parameters
Type Parameter |
---|
T |
Parameters
Parameter | Type |
---|---|
url | string |
params ? | IRequestParams |
Returns
Promise
<HTTPEvent
<T
>>
Defined in
packages/network/src/services/http/http.service.ts:116 (opens in a new tab)
dispose()
dispose(): void
Returns
void
Inherited from
Defined in
packages/core/src/shared/lifecycle.ts:106 (opens in a new tab)
disposeWithMe()
disposeWithMe(disposable): IDisposable
Parameters
Parameter | Type |
---|---|
disposable | DisposableLike |
Returns
Inherited from
Defined in
packages/core/src/shared/lifecycle.ts:96 (opens in a new tab)
ensureNotDisposed()
protected ensureNotDisposed(): void
Returns
void
Inherited from
Defined in
packages/core/src/shared/lifecycle.ts:100 (opens in a new tab)
get()
get<T>(url, params?): Promise<HTTPEvent<T>>
Type Parameters
Type Parameter |
---|
T |
Parameters
Parameter | Type |
---|---|
url | string |
params ? | IRequestParams |
Returns
Promise
<HTTPEvent
<T
>>
Defined in
packages/network/src/services/http/http.service.ts:104 (opens in a new tab)
getSSE()
getSSE<T>(
method,
url,
options?): Observable<HTTPEvent<T>>
Type Parameters
Type Parameter |
---|
T |
Parameters
Parameter | Type |
---|---|
method | HTTPRequestMethod |
url | string |
options ? | IPostRequestParams |
Returns
Observable
<HTTPEvent
<T
>>
Defined in
packages/network/src/services/http/http.service.ts:124 (opens in a new tab)
patch()
patch<T>(url, options?): Promise<HTTPEvent<T>>
Type Parameters
Type Parameter |
---|
T |
Parameters
Parameter | Type |
---|---|
url | string |
options ? | IPostRequestParams |
Returns
Promise
<HTTPEvent
<T
>>
Defined in
packages/network/src/services/http/http.service.ts:120 (opens in a new tab)
post()
post<T>(url, params?): Promise<HTTPEvent<T>>
Type Parameters
Type Parameter |
---|
T |
Parameters
Parameter | Type |
---|---|
url | string |
params ? | IPostRequestParams |
Returns
Promise
<HTTPEvent
<T
>>
Defined in
packages/network/src/services/http/http.service.ts:108 (opens in a new tab)
put()
put<T>(url, params?): Promise<HTTPEvent<T>>
Type Parameters
Type Parameter |
---|
T |
Parameters
Parameter | Type |
---|---|
url | string |
params ? | IPostRequestParams |
Returns
Promise
<HTTPEvent
<T
>>
Defined in
packages/network/src/services/http/http.service.ts:112 (opens in a new tab)
registerHTTPInterceptor()
registerHTTPInterceptor(interceptor): IDisposable
Register an HTTP interceptor.
Parameters
Parameter | Type | Description |
---|---|---|
interceptor | IHTTPInterceptor | the http interceptor |
Returns
a disposable handler to remove the interceptor
Defined in
packages/network/src/services/http/http.service.ts:91 (opens in a new tab)