API Reference
@univerjs
@univerjs/network
classes
Httpservice

@univerjs/network v0.4.2Docs


Class: HTTPService

This service provides http request methods and allows to register http interceptors.

You can use interceptors to:

  1. modify requests (headers included) before they are sent, or modify responses before they are returned to the caller.
  2. threshold, logging, caching, etc.
  3. authentication, authorization, etc.

Extends

Constructors

new HTTPService()

new HTTPService(_http): HTTPService

Parameters

ParameterType
_httpIHTTPImplementation

Returns

HTTPService

Overrides

Disposable.constructor

Defined in

packages/network/src/services/http/http.service.ts:81 (opens in a new tab)

Properties

PropertyModifierTypeDefault valueInherited fromDefined in
_disposedprotectedbooleanfalseDisposable._disposedpackages/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

ParameterType
urlstring
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

Disposable.dispose

Defined in

packages/core/src/shared/lifecycle.ts:106 (opens in a new tab)


disposeWithMe()

disposeWithMe(disposable): IDisposable

Parameters

ParameterType
disposableDisposableLike

Returns

IDisposable

Inherited from

Disposable.disposeWithMe

Defined in

packages/core/src/shared/lifecycle.ts:96 (opens in a new tab)


ensureNotDisposed()

protected ensureNotDisposed(): void

Returns

void

Inherited from

Disposable.ensureNotDisposed

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

ParameterType
urlstring
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

ParameterType
methodHTTPRequestMethod
urlstring
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

ParameterType
urlstring
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

ParameterType
urlstring
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

ParameterType
urlstring
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

ParameterTypeDescription
interceptorIHTTPInterceptorthe http interceptor

Returns

IDisposable

a disposable handler to remove the interceptor

Defined in

packages/network/src/services/http/http.service.ts:91 (opens in a new tab)


Copyright © 2021-2024 DreamNum Co,Ltd. All Rights Reserved.