HttpClient

执行 HTTP 请求。

Perform HTTP requests.

查看"说明"...

class HttpClient { request(first: string | HttpRequest<any>, url?: string, options: { body?: any; headers?: HttpHeaders | { [header: string]: string | string[]; }; observe?: HttpObserve; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType?: "arraybuffer" | ... 2 more ... | "json"; withCredentials?: boolean; } = {}): Observable<any> delete(url: string, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe?: HttpObserve; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType?: "arraybuffer" | "blob" | "text" | "json"; withCredentials?: boolean; } = {}): Observable<any> get(url: string, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe?: HttpObserve; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType?: "arraybuffer" | "blob" | "text" | "json"; withCredentials?: boolean; } = {}): Observable<any> head(url: string, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe?: HttpObserve; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType?: "arraybuffer" | "blob" | "text" | "json"; withCredentials?: boolean; } = {}): Observable<any> jsonp<T>(url: string, callbackParam: string): Observable<T> options(url: string, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe?: HttpObserve; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType?: "arraybuffer" | "blob" | "text" | "json"; withCredentials?: boolean; } = {}): Observable<any> patch(url: string, body: any, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe?: HttpObserve; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType?: "arraybuffer" | "blob" | "text" | "json"; withCredentials?: boolean; } = {}): Observable<any> post(url: string, body: any, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe?: HttpObserve; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType?: "arraybuffer" | "blob" | "text" | "json"; withCredentials?: boolean; } = {}): Observable<any> put(url: string, body: any, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe?: HttpObserve; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType?: "arraybuffer" | "blob" | "text" | "json"; withCredentials?: boolean; } = {}): Observable<any> }
      
      class HttpClient {
  request(first: string | HttpRequest<any>, url?: string, options: { body?: any; headers?: HttpHeaders | { [header: string]: string | string[]; }; observe?: HttpObserve; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType?: "arraybuffer" | ... 2 more ... | "json"; withCredentials?: boolean; } = {}): Observable<any>
  delete(url: string, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe?: HttpObserve; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType?: "arraybuffer" | "blob" | "text" | "json"; withCredentials?: boolean; } = {}): Observable<any>
  get(url: string, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe?: HttpObserve; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType?: "arraybuffer" | "blob" | "text" | "json"; withCredentials?: boolean; } = {}): Observable<any>
  head(url: string, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe?: HttpObserve; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType?: "arraybuffer" | "blob" | "text" | "json"; withCredentials?: boolean; } = {}): Observable<any>
  jsonp<T>(url: string, callbackParam: string): Observable<T>
  options(url: string, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe?: HttpObserve; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType?: "arraybuffer" | "blob" | "text" | "json"; withCredentials?: boolean; } = {}): Observable<any>
  patch(url: string, body: any, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe?: HttpObserve; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType?: "arraybuffer" | "blob" | "text" | "json"; withCredentials?: boolean; } = {}): Observable<any>
  post(url: string, body: any, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe?: HttpObserve; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType?: "arraybuffer" | "blob" | "text" | "json"; withCredentials?: boolean; } = {}): Observable<any>
  put(url: string, body: any, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe?: HttpObserve; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType?: "arraybuffer" | "blob" | "text" | "json"; withCredentials?: boolean; } = {}): Observable<any>
}
    

说明

HttpClient 是一个可供注入的类,具有一些用来执行 HTTP 请求的方法。 每个请求方法都有多重签名,并根据签名返回不同的数据类型(主要取决于 observeresponseType 的值)。

HttpClient is available as an injectable class, with methods to perform HTTP requests. Each request method has multiple signatures, and the return type varies according to which signature is called (mainly the values of observe and responseType).

方法

为一个特定的 HTTP 请求构造一个 Observable,当它被订阅时,就触发该请求,经过一系列已注册的拦截器的处理之后,最终发给服务器。

Constructs an Observable for a particular HTTP request that, when subscribed, fires the request through the chain of registered interceptors and on to the server.

Overload #1

发送指定的 HttpRequest 并返回一个由 HTTPEvents 组成的流。

Send the given HttpRequest and return a stream of HttpEvents.

request<R>(req: HttpRequest<any>): Observable<HttpEvent<R>>
      
      request<R>(req: HttpRequest<any>): Observable<HttpEvent<R>>
    
参数
req HttpRequest
返回值

Observable<HttpEvent<R>>


Overload #2

构造一个请求,这个请求会把 body 解释为 ArrayBuffer ,并返回它。

Construct a request which interprets the body as an ArrayBuffer and returns it.

request(method: string, url: string, options: { body?: any; headers?: HttpHeaders | { [header: string]: string | string[]; }; observe?: "body"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType: "arraybuffer"; withCredentials?: boolean; }): Observable<ArrayBuffer>
      
      request(method: string, url: string, options: { body?: any; headers?: HttpHeaders | { [header: string]: string | string[]; }; observe?: "body"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType: "arraybuffer"; withCredentials?: boolean; }): Observable<ArrayBuffer>
    
参数
method string
url string
options object
返回值

一个由 ArrayBuffer 型的 body 组成的 Observable 对象。

Observable<ArrayBuffer>: an Observable of the body as an ArrayBuffer.


Overload #3

构造一个请求,这个请求会把 body 解释为 Blob ,并返回它。

Construct a request which interprets the body as a Blob and returns it.

request(method: string, url: string, options: { body?: any; headers?: HttpHeaders | { [header: string]: string | string[]; }; observe?: "body"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType: "blob"; withCredentials?: boolean; }): Observable<Blob>
      
      request(method: string, url: string, options: { body?: any; headers?: HttpHeaders | { [header: string]: string | string[]; }; observe?: "body"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType: "blob"; withCredentials?: boolean; }): Observable<Blob>
    
参数
method string
url string
options object
返回值

一个由 Blob 型的 body 组成的 Observable 对象。

Observable<Blob>: an Observable of the body as a Blob.


Overload #4

构造一个请求,这个请求会把 body 解释为文本,并返回它。

Construct a request which interprets the body as text and returns it.

request(method: string, url: string, options: { body?: any; headers?: HttpHeaders | { [header: string]: string | string[]; }; observe?: "body"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType: "text"; withCredentials?: boolean; }): Observable<string>
      
      request(method: string, url: string, options: { body?: any; headers?: HttpHeaders | { [header: string]: string | string[]; }; observe?: "body"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType: "text"; withCredentials?: boolean; }): Observable<string>
    
参数
method string
url string
options object
返回值

一个由 string 型的 body 组成的 Observable 对象。

Observable<string>: an Observable of the body as a string.


Overload #5

构造一个请求,这个请求会把 body 解释为 ArrayBuffer ,并返回完整的事件流。

Construct a request which interprets the body as an ArrayBuffer and returns the full event stream.

request(method: string, url: string, options: { body?: any; headers?: HttpHeaders | { [header: string]: string | string[]; }; params?: HttpParams | { [param: string]: string | string[]; }; observe: "events"; reportProgress?: boolean; responseType: "arraybuffer"; withCredentials?: boolean; }): Observable<HttpEvent<ArrayBuffer>>
      
      request(method: string, url: string, options: { body?: any; headers?: HttpHeaders | { [header: string]: string | string[]; }; params?: HttpParams | { [param: string]: string | string[]; }; observe: "events"; reportProgress?: boolean; responseType: "arraybuffer"; withCredentials?: boolean; }): Observable<HttpEvent<ArrayBuffer>>
    
参数
method string
url string
options object
返回值

一个由该请求的所有 HttpEvents 组成的 Observable 对象,事件的 body 是 ArrayBuffer 型的。

Observable<HttpEvent<ArrayBuffer>>: an Observable of all HttpEvents for the request, with a body type of ArrayBuffer.


Overload #6

构造一个请求,这个请求会把 body 解释为 Blob ,并返回完整的事件流。

Construct a request which interprets the body as an Blob and returns the full event stream.

request(method: string, url: string, options: { body?: any; headers?: HttpHeaders | { [header: string]: string | string[]; }; observe: "events"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType: "blob"; withCredentials?: boolean; }): Observable<HttpEvent<Blob>>
      
      request(method: string, url: string, options: { body?: any; headers?: HttpHeaders | { [header: string]: string | string[]; }; observe: "events"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType: "blob"; withCredentials?: boolean; }): Observable<HttpEvent<Blob>>
    
参数
method string
url string
options object
返回值

一个由该请求的所有 HttpEvents 组成的 Observable 对象,事件的 body 是 Blob 型的。

Observable<HttpEvent<Blob>>: an Observable of all HttpEvents for the request, with a body type of Blob.


Overload #7

构造一个请求,这个请求会把 body 解释为文本,并返回完整的事件流。

Construct a request which interprets the body as text and returns the full event stream.

request(method: string, url: string, options: { body?: any; headers?: HttpHeaders | { [header: string]: string | string[]; }; observe: "events"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType: "text"; withCredentials?: boolean; }): Observable<HttpEvent<string>>
      
      request(method: string, url: string, options: { body?: any; headers?: HttpHeaders | { [header: string]: string | string[]; }; observe: "events"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType: "text"; withCredentials?: boolean; }): Observable<HttpEvent<string>>
    
参数
method string
url string
options object
返回值

一个由该请求的所有 HttpEvents 组成的 Observable 对象,事件的 body 是 string 型的。

Observable<HttpEvent<string>>: an Observable of all HttpEvents for the request, with a body type of string.


Overload #8

构造一个请求,这个请求会把 body 解释为 JSON ,并返回完整的事件流。

Construct a request which interprets the body as JSON and returns the full event stream.

request(method: string, url: string, options: { body?: any; headers?: HttpHeaders | { [header: string]: string | string[]; }; reportProgress?: boolean; observe: "events"; params?: HttpParams | { [param: string]: string | string[]; }; responseType?: "json"; withCredentials?: boolean; }): Observable<HttpEvent<any>>
      
      request(method: string, url: string, options: { body?: any; headers?: HttpHeaders | { [header: string]: string | string[]; }; reportProgress?: boolean; observe: "events"; params?: HttpParams | { [param: string]: string | string[]; }; responseType?: "json"; withCredentials?: boolean; }): Observable<HttpEvent<any>>
    
参数
method string
url string
options object
返回值

一个由该请求的所有 HttpEvents 组成的 Observable 对象,事件的 body 是 Object 型的。

Observable<HttpEvent<any>>: an Observable of all HttpEvents for the request, with a body type of Object.


Overload #9

构造一个请求,这个请求会把 body 解释为 JSON ,并返回完整的事件流。

Construct a request which interprets the body as JSON and returns the full event stream.

request<R>(method: string, url: string, options: { body?: any; headers?: HttpHeaders | { [header: string]: string | string[]; }; reportProgress?: boolean; observe: "events"; params?: HttpParams | { [param: string]: string | string[]; }; responseType?: "json"; withCredentials?: boolean; }): Observable<HttpEvent<R>>
      
      request<R>(method: string, url: string, options: { body?: any; headers?: HttpHeaders | { [header: string]: string | string[]; }; reportProgress?: boolean; observe: "events"; params?: HttpParams | { [param: string]: string | string[]; }; responseType?: "json"; withCredentials?: boolean; }): Observable<HttpEvent<R>>
    
参数
method string
url string
options object
返回值

一个由该请求的所有 HttpEvents 组成的 Observable 对象,事件的 body 是 R 型的。

Observable<HttpEvent<R>>: an Observable of all HttpEvents for the request, with a body type of R.


Overload #10

构造一个请求,这个请求会把 body 解释为 ArrayBuffer ,并返回完整的响应体。

Construct a request which interprets the body as an ArrayBuffer and returns the full response.

request(method: string, url: string, options: { body?: any; headers?: HttpHeaders | { [header: string]: string | string[]; }; observe: "response"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType: "arraybuffer"; withCredentials?: boolean; }): Observable<HttpResponse<ArrayBuffer>>
      
      request(method: string, url: string, options: { body?: any; headers?: HttpHeaders | { [header: string]: string | string[]; }; observe: "response"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType: "arraybuffer"; withCredentials?: boolean; }): Observable<HttpResponse<ArrayBuffer>>
    
参数
method string
url string
options object
返回值

一个由该请求的 HttpResponse 组成的 Observable 对象,其 body 是 ArrayBuffer 型的。

Observable<HttpResponse<ArrayBuffer>>: an Observable of the HttpResponse for the request, with a body type of ArrayBuffer.


Overload #11

构造一个请求,这个请求会把 body 解释为 Blob ,并返回完整的响应体。

Construct a request which interprets the body as a Blob and returns the full response.

request(method: string, url: string, options: { body?: any; headers?: HttpHeaders | { [header: string]: string | string[]; }; observe: "response"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType: "blob"; withCredentials?: boolean; }): Observable<HttpResponse<Blob>>
      
      request(method: string, url: string, options: { body?: any; headers?: HttpHeaders | { [header: string]: string | string[]; }; observe: "response"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType: "blob"; withCredentials?: boolean; }): Observable<HttpResponse<Blob>>
    
参数
method string
url string
options object
返回值

一个由该请求的 HttpResponse 组成的 Observable 对象,其 body 是 Blob 型的。

Observable<HttpResponse<Blob>>: an Observable of the HttpResponse for the request, with a body type of Blob.


Overload #12

构造一个请求,这个请求会把 body 解释为文本,并返回完整的响应体。

Construct a request which interprets the body as text and returns the full response.

request(method: string, url: string, options: { body?: any; headers?: HttpHeaders | { [header: string]: string | string[]; }; observe: "response"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType: "text"; withCredentials?: boolean; }): Observable<HttpResponse<string>>
      
      request(method: string, url: string, options: { body?: any; headers?: HttpHeaders | { [header: string]: string | string[]; }; observe: "response"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType: "text"; withCredentials?: boolean; }): Observable<HttpResponse<string>>
    
参数
method string
url string
options object
返回值

一个由该请求的 HttpResponse 组成的 Observable 对象,其 body 是 string 型的。

Observable<HttpResponse<string>>: an Observable of the HttpResponse for the request, with a body type of string.


Overload #13

构造一个请求,这个请求会把 body 解释为 JSON ,并返回完整的响应体。

Construct a request which interprets the body as JSON and returns the full response.

request(method: string, url: string, options: { body?: any; headers?: HttpHeaders | { [header: string]: string | string[]; }; reportProgress?: boolean; observe: "response"; params?: HttpParams | { [param: string]: string | string[]; }; responseType?: "json"; withCredentials?: boolean; }): Observable<HttpResponse<Object>>
      
      request(method: string, url: string, options: { body?: any; headers?: HttpHeaders | { [header: string]: string | string[]; }; reportProgress?: boolean; observe: "response"; params?: HttpParams | { [param: string]: string | string[]; }; responseType?: "json"; withCredentials?: boolean; }): Observable<HttpResponse<Object>>
    
参数
method string
url string
options object
返回值

一个由该请求的 HttpResponse 组成的 Observable 对象,其 body 是 Object 型的。

Observable<HttpResponse<Object>>: an Observable of the HttpResponse for the request, with a body type of Object.


Overload #14

构造一个请求,这个请求会把 body 解释为 JSON ,并返回完整的响应体。

Construct a request which interprets the body as JSON and returns the full response.

request<R>(method: string, url: string, options: { body?: any; headers?: HttpHeaders | { [header: string]: string | string[]; }; reportProgress?: boolean; observe: "response"; params?: HttpParams | { [param: string]: string | string[]; }; responseType?: "json"; withCredentials?: boolean; }): Observable<HttpResponse<R>>
      
      request<R>(method: string, url: string, options: { body?: any; headers?: HttpHeaders | { [header: string]: string | string[]; }; reportProgress?: boolean; observe: "response"; params?: HttpParams | { [param: string]: string | string[]; }; responseType?: "json"; withCredentials?: boolean; }): Observable<HttpResponse<R>>
    
参数
method string
url string
options object
返回值

一个由该请求的 HttpResponse 组成的 Observable 对象,其 body 是 R 型的。

Observable<HttpResponse<R>>: an Observable of the HttpResponse for the request, with a body type of R.


Overload #15

构造一个请求,这个请求会把 body 解释为 JSON ,并返回它。

Construct a request which interprets the body as JSON and returns it.

request(method: string, url: string, options?: { body?: any; headers?: HttpHeaders | { [header: string]: string | string[]; }; observe?: "body"; params?: HttpParams | { [param: string]: string | string[]; }; responseType?: "json"; reportProgress?: boolean; withCredentials?: boolean; }): Observable<Object>
      
      request(method: string, url: string, options?: { body?: any; headers?: HttpHeaders | { [header: string]: string | string[]; }; observe?: "body"; params?: HttpParams | { [param: string]: string | string[]; }; responseType?: "json"; reportProgress?: boolean; withCredentials?: boolean; }): Observable<Object>
    
参数
method string
url string
options object

可选. 默认值是 undefined.

返回值

一个由该请求的 HttpResponse 组成的 Observable 对象,其 body 是 Object 型的。

Observable<Object>: an Observable of the HttpResponse for the request, with a body type of Object.


Overload #16

构造一个请求,这个请求会把 body 解释为 JSON ,并返回它。

Construct a request which interprets the body as JSON and returns it.

request<R>(method: string, url: string, options?: { body?: any; headers?: HttpHeaders | { [header: string]: string | string[]; }; observe?: "body"; params?: HttpParams | { [param: string]: string | string[]; }; responseType?: "json"; reportProgress?: boolean; withCredentials?: boolean; }): Observable<R>
      
      request<R>(method: string, url: string, options?: { body?: any; headers?: HttpHeaders | { [header: string]: string | string[]; }; observe?: "body"; params?: HttpParams | { [param: string]: string | string[]; }; responseType?: "json"; reportProgress?: boolean; withCredentials?: boolean; }): Observable<R>
    
参数
method string
url string
options object

可选. 默认值是 undefined.

返回值

一个由该请求的 HttpResponse 组成的 Observable 对象,其 body 是 R 型的。

Observable<R>: an Observable of the HttpResponse for the request, with a body type of R.


Overload #17

以某种方式构造请求,其响应类型和所请求的 Observable 都是无法静态获知的。

Construct a request in a manner where response type and requested Observable are not known statically.

request(method: string, url: string, options?: { body?: any; headers?: HttpHeaders | { [header: string]: string | string[]; }; params?: HttpParams | { [param: string]: string | string[]; }; observe?: HttpObserve; reportProgress?: boolean; responseType?: "arraybuffer" | ... 2 more ... | "json"; withCredentials?: boolean; }): Observable<any>
      
      request(method: string, url: string, options?: { body?: any; headers?: HttpHeaders | { [header: string]: string | string[]; }; params?: HttpParams | { [param: string]: string | string[]; }; observe?: HttpObserve; reportProgress?: boolean; responseType?: "arraybuffer" | ... 2 more ... | "json"; withCredentials?: boolean; }): Observable<any>
    
参数
method string
url string
options object

可选. 默认值是 undefined.

返回值

所请求的任意 Observable,其类型是 any

Observable<any>: an Observable of whatever was requested, typed to any.

该方法有两种调用方式。或者直接把一个 HttpRequest 实例作为唯一的参数传进去,或者第一个参数传入 method,第二个参数传入 URL,第三个参数传入表示配置项的哈希对象。

This method can be called in one of two ways. Either an HttpRequest instance can be passed directly as the only parameter, or a method can be passed as the first parameter, a string URL as the second, and an options hash as the third.

如果直接传入 HttpRequest 对象,它就会返回一个原始 HttpEvent 组成的 Observable 流。

If a HttpRequest object is passed directly, an Observable of the raw HttpEvent stream will be returned.

如果是通过提供 URL 的方式构建的,配置项将决定 request() 的返回值类型。 除了配置请求头或 body 等请求参数之外,该配置项的哈希对象中还可以指定两个和请求本身有关的键:responseType 以及想要 observe 什么。

If a request is instead built by providing a URL, the options object determines the return type of request(). In addition to configuring request parameters such as the outgoing headers and/or the body, the options hash specifies two key pieces of information about the request: the responseType and what to observe.

responseType 的值决定要如何解析响应体。如果 responseTypejson(默认值),则还可以为 request 传入一个用来表示结果类型的类型接口。

The responseType value determines how a successful response body will be parsed. If responseType is the default json, a type interface for the resulting object may be passed as a type parameter to request().

observe 的值决定 request() 的返回值类型,这取决于消费方在订阅时对哪些东西感兴趣。 当它的值是 events 时,它将返回一个 Observable<HttpEvent>,以表示原始的 HTTPEvent 流,默认还包括网络通讯进度事件。 当它的值是 response 时,它将返回一个 Observable<HttpResponse<T>>HttpResponseT 参数 取决于 responseType 以及可选提供的类型参数。 当它的值是 body 时,它将返回一个 body 类型为 TObservable<T> 对象。

The observe value determines the return type of request(), based on what the consumer is interested in observing. A value of events will return an Observable<HttpEvent> representing the raw HttpEvent stream, including progress events by default. A value of response will return an Observable<HttpResponse<T>> where the T parameter of HttpResponse depends on the responseType and any optionally provided type parameter. A value of body will return an Observable<T> with the same T body type.

构造一个 Observable,当订阅它时,将导致服务器执行一个配置好的 DELETE 请求。 关于 delete() 返回类型的详细信息取决于所提供的选项,参见它的各个重载形式。

Constructs an Observable which, when subscribed, will cause the configured DELETE request to be executed on the server. See the individual overloads for details of delete()'s return type based on the provided options.

Overload #1

构造一个 DELETE 请求,这个请求会把 body 解释为 ArrayBuffer ,并返回它。

Construct a DELETE request which interprets the body as an ArrayBuffer and returns it.

delete(url: string, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe?: "body"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType: "arraybuffer"; withCredentials?: boolean; }): Observable<ArrayBuffer>
      
      delete(url: string, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe?: "body"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType: "arraybuffer"; withCredentials?: boolean; }): Observable<ArrayBuffer>
    
参数
url string
options object
返回值

一个由 ArrayBuffer 型的 body 组成的 Observable 对象。

Observable<ArrayBuffer>: an Observable of the body as an ArrayBuffer.


Overload #2

构造一个 DELETE 请求,这个请求会把 body 解释为 Blob ,并返回它。

Construct a DELETE request which interprets the body as a Blob and returns it.

delete(url: string, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe?: "body"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType: "blob"; withCredentials?: boolean; }): Observable<Blob>
      
      delete(url: string, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe?: "body"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType: "blob"; withCredentials?: boolean; }): Observable<Blob>
    
参数
url string
options object
返回值

一个由 Blob 型的 body 组成的 Observable 对象。

Observable<Blob>: an Observable of the body as a Blob.


Overload #3

构造一个 DELETE 请求,这个请求会把 body 解释为文本,并返回它。

Construct a DELETE request which interprets the body as text and returns it.

delete(url: string, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe?: "body"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType: "text"; withCredentials?: boolean; }): Observable<string>
      
      delete(url: string, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe?: "body"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType: "text"; withCredentials?: boolean; }): Observable<string>
    
参数
url string
options object
返回值

一个由 string 型的 body 组成的 Observable 对象。

Observable<string>: an Observable of the body as a string.


Overload #4

构造一个 DELETE 请求,这个请求会把 body 解释为 ArrayBuffer ,并返回完整的事件流。

Construct a DELETE request which interprets the body as an ArrayBuffer and returns the full event stream.

delete(url: string, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe: "events"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType: "arraybuffer"; withCredentials?: boolean; }): Observable<HttpEvent<ArrayBuffer>>
      
      delete(url: string, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe: "events"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType: "arraybuffer"; withCredentials?: boolean; }): Observable<HttpEvent<ArrayBuffer>>
    
参数
url string
options object
返回值

一个由该请求的所有 HttpEvents 组成的 Observable 对象,事件的 body 是 ArrayBuffer 型的。

Observable<HttpEvent<ArrayBuffer>>: an Observable of all HttpEvents for the request, with a body type of ArrayBuffer.


Overload #5

构造一个 DELETE 请求,这个请求会把 body 解释为 Blob ,并返回完整的事件流。

Construct a DELETE request which interprets the body as a Blob and returns the full event stream.

delete(url: string, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe: "events"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType: "blob"; withCredentials?: boolean; }): Observable<HttpEvent<Blob>>
      
      delete(url: string, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe: "events"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType: "blob"; withCredentials?: boolean; }): Observable<HttpEvent<Blob>>
    
参数
url string
options object
返回值

一个由该请求的所有 HttpEvents 组成的 Observable 对象,事件的 body 是 Blob 型的。

Observable<HttpEvent<Blob>>: an Observable of all HttpEvents for the request, with a body type of Blob.


Overload #6

构造一个 DELETE 请求,这个请求会把 body 解释为文本,并返回完整的事件流。

Construct a DELETE request which interprets the body as text and returns the full event stream.

delete(url: string, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe: "events"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType: "text"; withCredentials?: boolean; }): Observable<HttpEvent<string>>
      
      delete(url: string, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe: "events"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType: "text"; withCredentials?: boolean; }): Observable<HttpEvent<string>>
    
参数
url string
options object
返回值

一个由该请求的所有 HttpEvents 组成的 Observable 对象,事件的 body 是 string 型的。

Observable<HttpEvent<string>>: an Observable of all HttpEvents for the request, with a body type of string.


Overload #7

构造一个 DELETE 请求,这个请求会把 body 解释为 JSON ,并返回完整的事件流。

Construct a DELETE request which interprets the body as JSON and returns the full event stream.

delete(url: string, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe: "events"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType?: "json"; withCredentials?: boolean; }): Observable<HttpEvent<Object>>
      
      delete(url: string, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe: "events"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType?: "json"; withCredentials?: boolean; }): Observable<HttpEvent<Object>>
    
参数
url string
options object
返回值

一个由该请求的所有 HttpEvents 组成的 Observable 对象,事件的 body 是 Object 型的。

Observable<HttpEvent<Object>>: an Observable of all HttpEvents for the request, with a body type of Object.


Overload #8

构造一个 DELETE 请求,这个请求会把 body 解释为 JSON ,并返回完整的事件流。

Construct a DELETE request which interprets the body as JSON and returns the full event stream.

delete<T>(url: string, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe: "events"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType?: "json"; withCredentials?: boolean; }): Observable<HttpEvent<T>>
      
      delete<T>(url: string, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe: "events"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType?: "json"; withCredentials?: boolean; }): Observable<HttpEvent<T>>
    
参数
url string
options object
返回值

一个由该请求的所有 HttpEvents 组成的 Observable 对象,事件的 body 是 T 型的。

Observable<HttpEvent<T>>: an Observable of all HttpEvents for the request, with a body type of T.


Overload #9

构造一个 DELETE 请求,这个请求会把 body 解释为 ArrayBuffer ,并返回完整的响应体。

Construct a DELETE request which interprets the body as an ArrayBuffer and returns the full response.

delete(url: string, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe: "response"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType: "arraybuffer"; withCredentials?: boolean; }): Observable<HttpResponse<ArrayBuffer>>
      
      delete(url: string, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe: "response"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType: "arraybuffer"; withCredentials?: boolean; }): Observable<HttpResponse<ArrayBuffer>>
    
参数
url string
options object
返回值

一个由该请求的 HttpResponse 组成的 Observable 对象,其 body 是 ArrayBuffer 型的。

Observable<HttpResponse<ArrayBuffer>>: an Observable of the HttpResponse for the request, with a body type of ArrayBuffer.


Overload #10

构造一个 DELETE 请求,这个请求会把 body 解释为 Blob ,并返回完整的响应体。

Construct a DELETE request which interprets the body as a Blob and returns the full response.

delete(url: string, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe: "response"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType: "blob"; withCredentials?: boolean; }): Observable<HttpResponse<Blob>>
      
      delete(url: string, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe: "response"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType: "blob"; withCredentials?: boolean; }): Observable<HttpResponse<Blob>>
    
参数
url string
options object
返回值

一个由该请求的 HttpResponse 组成的 Observable 对象,其 body 是 Blob 型的。

Observable<HttpResponse<Blob>>: an Observable of the HttpResponse for the request, with a body type of Blob.


Overload #11

构造一个 DELETE 请求,这个请求会把 body 解释为文本,并返回完整的响应体。

Construct a DELETE request which interprets the body as text and returns the full response.

delete(url: string, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe: "response"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType: "text"; withCredentials?: boolean; }): Observable<HttpResponse<string>>
      
      delete(url: string, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe: "response"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType: "text"; withCredentials?: boolean; }): Observable<HttpResponse<string>>
    
参数
url string
options object
返回值

一个由该请求的 HttpResponse 组成的 Observable 对象,其 body 是 string 型的。

Observable<HttpResponse<string>>: an Observable of the HttpResponse for the request, with a body type of string.


Overload #12

构造一个 DELETE 请求,这个请求会把 body 解释为 JSON ,并返回完整的响应体。

Construct a DELETE request which interprets the body as JSON and returns the full response.

delete(url: string, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe: "response"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType?: "json"; withCredentials?: boolean; }): Observable<HttpResponse<Object>>
      
      delete(url: string, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe: "response"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType?: "json"; withCredentials?: boolean; }): Observable<HttpResponse<Object>>
    
参数
url string
options object
返回值

一个由该请求的 HttpResponse 组成的 Observable 对象,其 body 是 Object 型的。

Observable<HttpResponse<Object>>: an Observable of the HttpResponse for the request, with a body type of Object.


Overload #13

构造一个 DELETE 请求,这个请求会把 body 解释为 JSON ,并返回完整的响应体。

Construct a DELETE request which interprets the body as JSON and returns the full response.

delete<T>(url: string, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe: "response"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType?: "json"; withCredentials?: boolean; }): Observable<HttpResponse<T>>
      
      delete<T>(url: string, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe: "response"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType?: "json"; withCredentials?: boolean; }): Observable<HttpResponse<T>>
    
参数
url string
options object
返回值

一个由该请求的 HttpResponse 组成的 Observable 对象,其 body 是 T 型的。

Observable<HttpResponse<T>>: an Observable of the HttpResponse for the request, with a body type of T.


Overload #14

构造一个 DELETE 请求,这个请求会把 body 解释为 JSON ,并返回它。

Construct a DELETE request which interprets the body as JSON and returns it.

delete(url: string, options?: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe?: "body"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType?: "json"; withCredentials?: boolean; }): Observable<Object>
      
      delete(url: string, options?: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe?: "body"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType?: "json"; withCredentials?: boolean; }): Observable<Object>
    
参数
url string
options object

可选. 默认值是 undefined.

返回值

一个由 Object 型的 body 组成的 Observable 对象。

Observable<Object>: an Observable of the body as an Object.


Overload #15

构造一个 DELETE 请求,这个请求会把 body 解释为 JSON ,并返回它。

Construct a DELETE request which interprets the body as JSON and returns it.

delete<T>(url: string, options?: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe?: "body"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType?: "json"; withCredentials?: boolean; }): Observable<T>
      
      delete<T>(url: string, options?: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe?: "body"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType?: "json"; withCredentials?: boolean; }): Observable<T>
    
参数
url string
options object

可选. 默认值是 undefined.

返回值

一个由 T 型的 body 组成的 Observable 对象。

Observable<T>: an Observable of the body as type T.

构造一个 Observable,当订阅它时,将导致服务器执行一个配置好的 GET 请求。 关于 get() 返回类型的详细信息取决于所提供的选项,参见它的各个重载形式。

Constructs an Observable which, when subscribed, will cause the configured GET request to be executed on the server. See the individual overloads for details of get()'s return type based on the provided options.

Overload #1

构造一个 GET 请求,这个请求会把 body 解释为 ArrayBuffer ,并返回它。

Construct a GET request which interprets the body as an ArrayBuffer and returns it.

get(url: string, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe?: "body"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType: "arraybuffer"; withCredentials?: boolean; }): Observable<ArrayBuffer>
      
      get(url: string, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe?: "body"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType: "arraybuffer"; withCredentials?: boolean; }): Observable<ArrayBuffer>
    
参数
url string
options object
返回值

一个由 ArrayBuffer 型的 body 组成的 Observable 对象。

Observable<ArrayBuffer>: an Observable of the body as an ArrayBuffer.


Overload #2

构造一个 GET 请求,这个请求会把 body 解释为 Blob ,并返回它。

Construct a GET request which interprets the body as a Blob and returns it.

get(url: string, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe?: "body"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType: "blob"; withCredentials?: boolean; }): Observable<Blob>
      
      get(url: string, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe?: "body"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType: "blob"; withCredentials?: boolean; }): Observable<Blob>
    
参数
url string
options object
返回值

一个由 Blob 型的 body 组成的 Observable 对象。

Observable<Blob>: an Observable of the body as a Blob.


Overload #3

构造一个 GET 请求,这个请求会把 body 解释为文本,并返回它。

Construct a GET request which interprets the body as text and returns it.

get(url: string, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe?: "body"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType: "text"; withCredentials?: boolean; }): Observable<string>
      
      get(url: string, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe?: "body"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType: "text"; withCredentials?: boolean; }): Observable<string>
    
参数
url string
options object
返回值

一个由 string 型的 body 组成的 Observable 对象。

Observable<string>: an Observable of the body as a string.


Overload #4

构造一个 GET 请求,这个请求会把 body 解释为 ArrayBuffer ,并返回完整的事件流。

Construct a GET request which interprets the body as an ArrayBuffer and returns the full event stream.

get(url: string, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe: "events"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType: "arraybuffer"; withCredentials?: boolean; }): Observable<HttpEvent<ArrayBuffer>>
      
      get(url: string, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe: "events"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType: "arraybuffer"; withCredentials?: boolean; }): Observable<HttpEvent<ArrayBuffer>>
    
参数
url string
options object
返回值

一个由该请求的所有 HttpEvents 组成的 Observable 对象,事件的 body 是 ArrayBuffer 型的。

Observable<HttpEvent<ArrayBuffer>>: an Observable of all HttpEvents for the request, with a body type of ArrayBuffer.


Overload #5

构造一个 GET 请求,这个请求会把 body 解释为 Blob ,并返回完整的事件流。

Construct a GET request which interprets the body as a Blob and returns the full event stream.

get(url: string, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe: "events"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType: "blob"; withCredentials?: boolean; }): Observable<HttpEvent<Blob>>
      
      get(url: string, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe: "events"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType: "blob"; withCredentials?: boolean; }): Observable<HttpEvent<Blob>>
    
参数
url string
options object
返回值

一个由该请求的所有 HttpEvents 组成的 Observable 对象,事件的 body 是 Blob 型的。

Observable<HttpEvent<Blob>>: an Observable of all HttpEvents for the request, with a body type of Blob.


Overload #6

构造一个 GET 请求,这个请求会把 body 解释为文本,并返回完整的事件流。

Construct a GET request which interprets the body as text and returns the full event stream.

get(url: string, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe: "events"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType: "text"; withCredentials?: boolean; }): Observable<HttpEvent<string>>
      
      get(url: string, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe: "events"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType: "text"; withCredentials?: boolean; }): Observable<HttpEvent<string>>
    
参数
url string
options object
返回值

一个由该请求的所有 HttpEvents 组成的 Observable 对象,事件的 body 是 string 型的。

Observable<HttpEvent<string>>: an Observable of all HttpEvents for the request, with a body type of string.


Overload #7

构造一个 GET 请求,这个请求会把 body 解释为 JSON ,并返回完整的事件流。

Construct a GET request which interprets the body as JSON and returns the full event stream.

get(url: string, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe: "events"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType?: "json"; withCredentials?: boolean; }): Observable<HttpEvent<Object>>
      
      get(url: string, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe: "events"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType?: "json"; withCredentials?: boolean; }): Observable<HttpEvent<Object>>
    
参数
url string
options object
返回值

一个由该请求的所有 HttpEvents 组成的 Observable 对象,事件的 body 是 Object 型的。

Observable<HttpEvent<Object>>: an Observable of all HttpEvents for the request, with a body type of Object.


Overload #8

构造一个 GET 请求,这个请求会把 body 解释为 JSON ,并返回完整的事件流。

Construct a GET request which interprets the body as JSON and returns the full event stream.

get<T>(url: string, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe: "events"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType?: "json"; withCredentials?: boolean; }): Observable<HttpEvent<T>>
      
      get<T>(url: string, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe: "events"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType?: "json"; withCredentials?: boolean; }): Observable<HttpEvent<T>>
    
参数
url string
options object
返回值

一个由该请求的所有 HttpEvents 组成的 Observable 对象,事件的 body 是 T 型的。

Observable<HttpEvent<T>>: an Observable of all HttpEvents for the request, with a body type of T.


Overload #9

构造一个 GET 请求,这个请求会把 body 解释为 ArrayBuffer ,并返回完整的响应体。

Construct a GET request which interprets the body as an ArrayBuffer and returns the full response.

get(url: string, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe: "response"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType: "arraybuffer"; withCredentials?: boolean; }): Observable<HttpResponse<ArrayBuffer>>
      
      get(url: string, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe: "response"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType: "arraybuffer"; withCredentials?: boolean; }): Observable<HttpResponse<ArrayBuffer>>
    
参数
url string
options object
返回值

一个由该请求的 HttpResponse 组成的 Observable 对象,其 body 是 ArrayBuffer 型的。

Observable<HttpResponse<ArrayBuffer>>: an Observable of the HttpResponse for the request, with a body type of ArrayBuffer.


Overload #10

构造一个 GET 请求,这个请求会把 body 解释为 Blob ,并返回完整的响应体。

Construct a GET request which interprets the body as a Blob and returns the full response.

get(url: string, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe: "response"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType: "blob"; withCredentials?: boolean; }): Observable<HttpResponse<Blob>>
      
      get(url: string, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe: "response"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType: "blob"; withCredentials?: boolean; }): Observable<HttpResponse<Blob>>
    
参数
url string
options object
返回值

一个由该请求的 HttpResponse 组成的 Observable 对象,其 body 是 Blob 型的。

Observable<HttpResponse<Blob>>: an Observable of the HttpResponse for the request, with a body type of Blob.


Overload #11

构造一个 GET 请求,这个请求会把 body 解释为文本,并返回完整的响应体。

Construct a GET request which interprets the body as text and returns the full response.

get(url: string, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe: "response"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType: "text"; withCredentials?: boolean; }): Observable<HttpResponse<string>>
      
      get(url: string, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe: "response"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType: "text"; withCredentials?: boolean; }): Observable<HttpResponse<string>>
    
参数
url string
options object
返回值

一个由该请求的 HttpResponse 组成的 Observable 对象,其 body 是 string 型的。

Observable<HttpResponse<string>>: an Observable of the HttpResponse for the request, with a body type of string.


Overload #12

构造一个 GET 请求,这个请求会把 body 解释为 JSON ,并返回完整的响应体。

Construct a GET request which interprets the body as JSON and returns the full response.

get(url: string, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe: "response"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType?: "json"; withCredentials?: boolean; }): Observable<HttpResponse<Object>>
      
      get(url: string, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe: "response"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType?: "json"; withCredentials?: boolean; }): Observable<HttpResponse<Object>>
    
参数
url string
options object
返回值

一个由该请求的 HttpResponse 组成的 Observable 对象,其 body 是 Object 型的。

Observable<HttpResponse<Object>>: an Observable of the HttpResponse for the request, with a body type of Object.


Overload #13

构造一个 GET 请求,这个请求会把 body 解释为 JSON ,并返回完整的响应体。

Construct a GET request which interprets the body as JSON and returns the full response.

get<T>(url: string, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe: "response"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType?: "json"; withCredentials?: boolean; }): Observable<HttpResponse<T>>
      
      get<T>(url: string, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe: "response"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType?: "json"; withCredentials?: boolean; }): Observable<HttpResponse<T>>
    
参数
url string
options object
返回值

一个由该请求的 HttpResponse 组成的 Observable 对象,其 body 是 T 型的。

Observable<HttpResponse<T>>: an Observable of the HttpResponse for the request, with a body type of T.


Overload #14

构造一个 GET 请求,这个请求会把 body 解释为 JSON ,并返回它。

Construct a GET request which interprets the body as JSON and returns it.

get(url: string, options?: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe?: "body"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType?: "json"; withCredentials?: boolean; }): Observable<Object>
      
      get(url: string, options?: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe?: "body"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType?: "json"; withCredentials?: boolean; }): Observable<Object>
    
参数
url string
options object

可选. 默认值是 undefined.

返回值

一个由 Object 型的 body 组成的 Observable 对象。

Observable<Object>: an Observable of the body as an Object.


Overload #15

构造一个 GET 请求,这个请求会把 body 解释为 JSON ,并返回它。

Construct a GET request which interprets the body as JSON and returns it.

get<T>(url: string, options?: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe?: "body"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType?: "json"; withCredentials?: boolean; }): Observable<T>
      
      get<T>(url: string, options?: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe?: "body"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType?: "json"; withCredentials?: boolean; }): Observable<T>
    
参数
url string
options object

可选. 默认值是 undefined.

返回值

一个由 T 型的 body 组成的 Observable 对象。

Observable<T>: an Observable of the body as type T.

构造一个 Observable,当订阅它时,将导致服务器执行一个配置好的 HEAD 请求。 关于 head() 返回类型的详细信息取决于所提供的选项,参见它的各个重载形式。

Constructs an Observable which, when subscribed, will cause the configured HEAD request to be executed on the server. See the individual overloads for details of head()'s return type based on the provided options.

Overload #1

构造一个 HEAD 请求,这个请求会把 body 解释为 ArrayBuffer ,并返回它。

Construct a HEAD request which interprets the body as an ArrayBuffer and returns it.

head(url: string, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe?: "body"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType: "arraybuffer"; withCredentials?: boolean; }): Observable<ArrayBuffer>
      
      head(url: string, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe?: "body"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType: "arraybuffer"; withCredentials?: boolean; }): Observable<ArrayBuffer>
    
参数
url string
options object
返回值

一个由 ArrayBuffer 型的 body 组成的 Observable 对象。

Observable<ArrayBuffer>: an Observable of the body as an ArrayBuffer.


Overload #2
head(url: string, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe?: "body"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType: "blob"; withCredentials?: boolean; }): Observable<Blob>
      
      head(url: string, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe?: "body"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType: "blob"; withCredentials?: boolean; }): Observable<Blob>
    
参数
url string
options object
返回值

Observable<Blob>


Overload #3

构造一个 HEAD 请求,这个请求会把 body 解释为文本,并返回它。

Construct a HEAD request which interprets the body as text and returns it.

head(url: string, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe?: "body"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType: "text"; withCredentials?: boolean; }): Observable<string>
      
      head(url: string, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe?: "body"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType: "text"; withCredentials?: boolean; }): Observable<string>
    
参数
url string
options object
返回值

一个由 string 型的 body 组成的 Observable 对象。

Observable<string>: an Observable of the body as a string.


Overload #4

构造一个 HEAD 请求,这个请求会把 body 解释为 ArrayBuffer ,并返回完整的事件流。

Construct a HEAD request which interprets the body as an ArrayBuffer and returns the full event stream.

head(url: string, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe: "events"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType: "arraybuffer"; withCredentials?: boolean; }): Observable<HttpEvent<ArrayBuffer>>
      
      head(url: string, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe: "events"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType: "arraybuffer"; withCredentials?: boolean; }): Observable<HttpEvent<ArrayBuffer>>
    
参数
url string
options object
返回值

一个由该请求的所有 HttpEvents 组成的 Observable 对象,事件的 body 是 ArrayBuffer 型的。

Observable<HttpEvent<ArrayBuffer>>: an Observable of all HttpEvents for the request, with a body type of ArrayBuffer.


Overload #5

构造一个 HEAD 请求,这个请求会把 body 解释为 Blob ,并返回完整的事件流。

Construct a HEAD request which interprets the body as a Blob and returns the full event stream.

head(url: string, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe: "events"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType: "blob"; withCredentials?: boolean; }): Observable<HttpEvent<Blob>>
      
      head(url: string, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe: "events"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType: "blob"; withCredentials?: boolean; }): Observable<HttpEvent<Blob>>
    
参数
url string
options object
返回值

一个由该请求的所有 HttpEvents 组成的 Observable 对象,事件的 body 是 Blob 型的。

Observable<HttpEvent<Blob>>: an Observable of all HttpEvents for the request, with a body type of Blob.


Overload #6

构造一个 HEAD 请求,这个请求会把 body 解释为文本,并返回完整的事件流。

Construct a HEAD request which interprets the body as text and returns the full event stream.

head(url: string, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe: "events"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType: "text"; withCredentials?: boolean; }): Observable<HttpEvent<string>>
      
      head(url: string, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe: "events"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType: "text"; withCredentials?: boolean; }): Observable<HttpEvent<string>>
    
参数
url string
options object
返回值

一个由该请求的所有 HttpEvents 组成的 Observable 对象,事件的 body 是 string 型的。

Observable<HttpEvent<string>>: an Observable of all HttpEvents for the request, with a body type of string.


Overload #7

构造一个 HEAD 请求,这个请求会把 body 解释为 JSON ,并返回完整的事件流。

Construct a HEAD request which interprets the body as JSON and returns the full event stream.

head(url: string, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe: "events"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType?: "json"; withCredentials?: boolean; }): Observable<HttpEvent<Object>>
      
      head(url: string, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe: "events"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType?: "json"; withCredentials?: boolean; }): Observable<HttpEvent<Object>>
    
参数
url string
options object
返回值

一个由该请求的所有 HttpEvents 组成的 Observable 对象,事件的 body 是 Object 型的。

Observable<HttpEvent<Object>>: an Observable of all HttpEvents for the request, with a body type of Object.


Overload #8

构造一个 HEAD 请求,这个请求会把 body 解释为 JSON ,并返回完整的事件流。

Construct a HEAD request which interprets the body as JSON and returns the full event stream.

head<T>(url: string, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe: "events"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType?: "json"; withCredentials?: boolean; }): Observable<HttpEvent<T>>
      
      head<T>(url: string, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe: "events"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType?: "json"; withCredentials?: boolean; }): Observable<HttpEvent<T>>
    
参数
url string
options object
返回值

一个由该请求的所有 HttpEvents 组成的 Observable 对象,事件的 body 是 T 型的。

Observable<HttpEvent<T>>: an Observable of all HttpEvents for the request, with a body type of T.


Overload #9

构造一个 HEAD 请求,这个请求会把 body 解释为 ArrayBuffer ,并返回完整的响应体。

Construct a HEAD request which interprets the body as an ArrayBuffer and returns the full response.

head(url: string, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe: "response"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType: "arraybuffer"; withCredentials?: boolean; }): Observable<HttpResponse<ArrayBuffer>>
      
      head(url: string, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe: "response"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType: "arraybuffer"; withCredentials?: boolean; }): Observable<HttpResponse<ArrayBuffer>>
    
参数
url string
options object
返回值

一个由该请求的 HttpResponse 组成的 Observable 对象,其 body 是 ArrayBuffer 型的。

Observable<HttpResponse<ArrayBuffer>>: an Observable of the HttpResponse for the request, with a body type of ArrayBuffer.


Overload #10

构造一个 HEAD 请求,这个请求会把 body 解释为 Blob ,并返回完整的响应体。

Construct a HEAD request which interprets the body as a Blob and returns the full response.

head(url: string, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe: "response"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType: "blob"; withCredentials?: boolean; }): Observable<HttpResponse<Blob>>
      
      head(url: string, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe: "response"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType: "blob"; withCredentials?: boolean; }): Observable<HttpResponse<Blob>>
    
参数
url string
options object
返回值

一个由该请求的 HttpResponse 组成的 Observable 对象,其 body 是 Blob 型的。

Observable<HttpResponse<Blob>>: an Observable of the HttpResponse for the request, with a body type of Blob.


Overload #11

构造一个 HEAD 请求,这个请求会把 body 解释为文本,并返回完整的响应体。

Construct a HEAD request which interprets the body as text and returns the full response.

head(url: string, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe: "response"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType: "text"; withCredentials?: boolean; }): Observable<HttpResponse<string>>
      
      head(url: string, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe: "response"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType: "text"; withCredentials?: boolean; }): Observable<HttpResponse<string>>
    
参数
url string
options object
返回值

一个由该请求的 HttpResponse 组成的 Observable 对象,其 body 是 string 型的。

Observable<HttpResponse<string>>: an Observable of the HttpResponse for the request, with a body type of string.


Overload #12

构造一个 HEAD 请求,这个请求会把 body 解释为 JSON ,并返回完整的响应体。

Construct a HEAD request which interprets the body as JSON and returns the full response.

head(url: string, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe: "response"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType?: "json"; withCredentials?: boolean; }): Observable<HttpResponse<Object>>
      
      head(url: string, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe: "response"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType?: "json"; withCredentials?: boolean; }): Observable<HttpResponse<Object>>
    
参数
url string
options object
返回值

一个由该请求的 HttpResponse 组成的 Observable 对象,其 body 是 Object 型的。

Observable<HttpResponse<Object>>: an Observable of the HttpResponse for the request, with a body type of Object.


Overload #13

构造一个 HEAD 请求,这个请求会把 body 解释为 JSON ,并返回完整的响应体。

Construct a HEAD request which interprets the body as JSON and returns the full response.

head<T>(url: string, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe: "response"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType?: "json"; withCredentials?: boolean; }): Observable<HttpResponse<T>>
      
      head<T>(url: string, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe: "response"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType?: "json"; withCredentials?: boolean; }): Observable<HttpResponse<T>>
    
参数
url string
options object
返回值

一个由该请求的 HttpResponse 组成的 Observable 对象,其 body 是 T 型的。

Observable<HttpResponse<T>>: an Observable of the HttpResponse for the request, with a body type of T.


Overload #14

构造一个 HEAD 请求,这个请求会把 body 解释为 JSON ,并返回它。

Construct a HEAD request which interprets the body as JSON and returns it.

head(url: string, options?: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe?: "body"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType?: "json"; withCredentials?: boolean; }): Observable<Object>
      
      head(url: string, options?: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe?: "body"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType?: "json"; withCredentials?: boolean; }): Observable<Object>
    
参数
url string
options object

可选. 默认值是 undefined.

返回值

一个由 Object 型的 body 组成的 Observable 对象。

Observable<Object>: an Observable of the body as an Object.


Overload #15

构造一个 HEAD 请求,这个请求会把 body 解释为 JSON ,并返回它。

Construct a HEAD request which interprets the body as JSON and returns it.

head<T>(url: string, options?: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe?: "body"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType?: "json"; withCredentials?: boolean; }): Observable<T>
      
      head<T>(url: string, options?: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe?: "body"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType?: "json"; withCredentials?: boolean; }): Observable<T>
    
参数
url string
options object

可选. 默认值是 undefined.

返回值

一个由 T 型的 body 组成的 Observable 对象。

Observable<T>: an Observable of the body as type T.

构造一个 Observable,订阅它将经过拦截器管道处理之后发送一个特殊的 JSONP 请求。

Constructs an Observable which, when subscribed, will cause a request with the special method JSONP to be dispatched via the interceptor pipeline.

使用指定的 URL 和回调函数名构造一个 JSONP 请求。

Construct a JSONP request for the given URL and name of the callback parameter.

jsonp(url: string, callbackParam: string): Observable<Object>
      
      jsonp(url: string, callbackParam: string): Observable<Object>
    
参数
url string
callbackParam string
返回值

一个 Object 型响应对象组成的 Observable 对象

Observable<Object>: an Observable of the response object as an Object

使用指定的 URL 和回调函数名构造一个 JSONP 请求。

Construct a JSONP request for the given URL and name of the callback parameter.

jsonp<T>(url: string, callbackParam: string): Observable<T>
      
      jsonp<T>(url: string, callbackParam: string): Observable<T>
    
参数
url string
callbackParam string
返回值

一个 T 型响应对象组成的 Observable 对象

Observable<T>: an Observable of the response object as type T.

必须安装一个合适的拦截器(比如借助 HttpClientJsonpModule)。 如果没有这个拦截器,JSONP 请求就可能被后端拒绝。

A suitable interceptor must be installed (e.g. via the HttpClientJsonpModule). If no such interceptor is reached, then the JSONP request will likely be rejected by the configured backend.

构造一个 Observable,当订阅它时,将导致服务器执行一个配置好的 OPTIONS 请求。 关于 options() 返回类型的详细信息取决于所提供的选项,参见它的各个重载形式。

Constructs an Observable which, when subscribed, will cause the configured OPTIONS request to be executed on the server. See the individual overloads for details of options()'s return type based on the provided options.

Overload #1

构造一个 OPTIONS 请求,这个请求会把 body 解释为 ArrayBuffer ,并返回它。

Make an OPTIONS request which interprets the body as an ArrayBuffer and returns it.

options(url: string, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe?: "body"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType: "arraybuffer"; withCredentials?: boolean; }): Observable<ArrayBuffer>
      
      options(url: string, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe?: "body"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType: "arraybuffer"; withCredentials?: boolean; }): Observable<ArrayBuffer>
    
参数
url string
options object
返回值

一个由 ArrayBuffer 型的 body 组成的 Observable 对象。

Observable<ArrayBuffer>: an Observable of the body as an ArrayBuffer.


Overload #2

构造一个 OPTIONS 请求,这个请求会把 body 解释为 Blob ,并返回它。

Construct an OPTIONS request which interprets the body as a Blob and returns it.

options(url: string, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe?: "body"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType: "blob"; withCredentials?: boolean; }): Observable<Blob>
      
      options(url: string, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe?: "body"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType: "blob"; withCredentials?: boolean; }): Observable<Blob>
    
参数
url string
options object
返回值

一个由 Blob 型的 body 组成的 Observable 对象。

Observable<Blob>: an Observable of the body as a Blob.


Overload #3

构造一个 OPTIONS 请求,这个请求会把 body 解释为文本,并返回它。

Construct an OPTIONS request which interprets the body as text and returns it.

options(url: string, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe?: "body"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType: "text"; withCredentials?: boolean; }): Observable<string>
      
      options(url: string, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe?: "body"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType: "text"; withCredentials?: boolean; }): Observable<string>
    
参数
url string
options object
返回值

一个由 string 型的 body 组成的 Observable 对象。

Observable<string>: an Observable of the body as a string.


Overload #4

构造一个 OPTIONS 请求,这个请求会把 body 解释为 ArrayBuffer ,并返回完整的事件流。

Construct an OPTIONS request which interprets the body as an ArrayBuffer and returns the full event stream.

options(url: string, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe: "events"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType: "arraybuffer"; withCredentials?: boolean; }): Observable<HttpEvent<ArrayBuffer>>
      
      options(url: string, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe: "events"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType: "arraybuffer"; withCredentials?: boolean; }): Observable<HttpEvent<ArrayBuffer>>
    
参数
url string
options object
返回值

一个由该请求的所有 HttpEvents 组成的 Observable 对象,事件的 body 是 ArrayBuffer 型的。

Observable<HttpEvent<ArrayBuffer>>: an Observable of all HttpEvents for the request, with a body type of ArrayBuffer.


Overload #5

构造一个 OPTIONS 请求,这个请求会把 body 解释为 Blob ,并返回完整的事件流。

Construct an OPTIONS request which interprets the body as a Blob and returns the full event stream.

options(url: string, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe: "events"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType: "blob"; withCredentials?: boolean; }): Observable<HttpEvent<Blob>>
      
      options(url: string, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe: "events"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType: "blob"; withCredentials?: boolean; }): Observable<HttpEvent<Blob>>
    
参数
url string
options object
返回值

一个由该请求的所有 HttpEvents 组成的 Observable 对象,事件的 body 是 Blob 型的。

Observable<HttpEvent<Blob>>: an Observable of all HttpEvents for the request, with a body type of Blob.


Overload #6

构造一个 OPTIONS 请求,这个请求会把 body 解释为文本,并返回完整的事件流。

Construct an OPTIONS request which interprets the body as text and returns the full event stream.

options(url: string, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe: "events"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType: "text"; withCredentials?: boolean; }): Observable<HttpEvent<string>>
      
      options(url: string, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe: "events"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType: "text"; withCredentials?: boolean; }): Observable<HttpEvent<string>>
    
参数
url string
options object
返回值

一个由该请求的所有 HttpEvents 组成的 Observable 对象,事件的 body 是 string 型的。

Observable<HttpEvent<string>>: an Observable of all HttpEvents for the request, with a body type of string.


Overload #7

构造一个 OPTIONS 请求,这个请求会把 body 解释为 JSON ,并返回完整的事件流。

Construct an OPTIONS request which interprets the body as JSON and returns the full event stream.

options(url: string, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe: "events"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType?: "json"; withCredentials?: boolean; }): Observable<HttpEvent<Object>>
      
      options(url: string, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe: "events"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType?: "json"; withCredentials?: boolean; }): Observable<HttpEvent<Object>>
    
参数
url string
options object
返回值

一个由该请求的所有 HttpEvents 组成的 Observable 对象,事件的 body 是 Object 型的。

Observable<HttpEvent<Object>>: an Observable of all HttpEvents for the request, with a body type of Object.


Overload #8

构造一个 OPTIONS 请求,这个请求会把 body 解释为 JSON ,并返回完整的事件流。

Construct an OPTIONS request which interprets the body as JSON and returns the full event stream.

options<T>(url: string, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe: "events"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType?: "json"; withCredentials?: boolean; }): Observable<HttpEvent<T>>
      
      options<T>(url: string, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe: "events"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType?: "json"; withCredentials?: boolean; }): Observable<HttpEvent<T>>
    
参数
url string
options object
返回值

一个由该请求的所有 HttpEvents 组成的 Observable 对象,事件的 body 是 T 型的。

Observable<HttpEvent<T>>: an Observable of all HttpEvents for the request, with a body type of T.


Overload #9

构造一个 OPTIONS 请求,这个请求会把 body 解释为 ArrayBuffer ,并返回完整的响应体。

Construct an OPTIONS request which interprets the body as an ArrayBuffer and returns the full response.

options(url: string, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe: "response"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType: "arraybuffer"; withCredentials?: boolean; }): Observable<HttpResponse<ArrayBuffer>>
      
      options(url: string, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe: "response"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType: "arraybuffer"; withCredentials?: boolean; }): Observable<HttpResponse<ArrayBuffer>>
    
参数
url string
options object
返回值

一个由该请求的 HttpResponse 组成的 Observable 对象,其 body 是 ArrayBuffer 型的。

Observable<HttpResponse<ArrayBuffer>>: an Observable of the HttpResponse for the request, with a body type of ArrayBuffer.


Overload #10

构造一个 OPTIONS 请求,这个请求会把 body 解释为 Blob ,并返回完整的响应体。

Construct an OPTIONS request which interprets the body as a Blob and returns the full response.

options(url: string, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe: "response"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType: "blob"; withCredentials?: boolean; }): Observable<HttpResponse<Blob>>
      
      options(url: string, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe: "response"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType: "blob"; withCredentials?: boolean; }): Observable<HttpResponse<Blob>>
    
参数
url string
options object
返回值

一个由该请求的 HttpResponse 组成的 Observable 对象,其 body 是 Blob 型的。

Observable<HttpResponse<Blob>>: an Observable of the HttpResponse for the request, with a body type of Blob.


Overload #11

构造一个 OPTIONS 请求,这个请求会把 body 解释为文本,并返回完整的响应体。

Construct an OPTIONS request which interprets the body as text and returns the full response.

options(url: string, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe: "response"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType: "text"; withCredentials?: boolean; }): Observable<HttpResponse<string>>
      
      options(url: string, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe: "response"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType: "text"; withCredentials?: boolean; }): Observable<HttpResponse<string>>
    
参数
url string
options object
返回值

一个由该请求的 HttpResponse 组成的 Observable 对象,其 body 是 string 型的。

Observable<HttpResponse<string>>: an Observable of the HttpResponse for the request, with a body type of string.


Overload #12

构造一个 OPTIONS 请求,这个请求会把 body 解释为 JSON ,并返回完整的响应体。

Construct an OPTIONS request which interprets the body as JSON and returns the full response.

options(url: string, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe: "response"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType?: "json"; withCredentials?: boolean; }): Observable<HttpResponse<Object>>
      
      options(url: string, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe: "response"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType?: "json"; withCredentials?: boolean; }): Observable<HttpResponse<Object>>
    
参数
url string
options object
返回值

一个由该请求的 HttpResponse 组成的 Observable 对象,其 body 是 Object 型的。

Observable<HttpResponse<Object>>: an Observable of the HttpResponse for the request, with a body type of Object.


Overload #13

构造一个 OPTIONS 请求,这个请求会把 body 解释为 JSON ,并返回完整的响应体。

Construct an OPTIONS request which interprets the body as JSON and returns the full response.

options<T>(url: string, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe: "response"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType?: "json"; withCredentials?: boolean; }): Observable<HttpResponse<T>>
      
      options<T>(url: string, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe: "response"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType?: "json"; withCredentials?: boolean; }): Observable<HttpResponse<T>>
    
参数
url string
options object
返回值

一个由该请求的 HttpResponse 组成的 Observable 对象,其 body 是 T 型的。

Observable<HttpResponse<T>>: an Observable of the HttpResponse for the request, with a body type of T.


Overload #14

构造一个 OPTIONS 请求,这个请求会把 body 解释为 JSON ,并返回它。

Construct an OPTIONS request which interprets the body as JSON and returns it.

options(url: string, options?: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe?: "body"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType?: "json"; withCredentials?: boolean; }): Observable<Object>
      
      options(url: string, options?: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe?: "body"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType?: "json"; withCredentials?: boolean; }): Observable<Object>
    
参数
url string
options object

可选. 默认值是 undefined.

返回值

一个由 Object 型的 body 组成的 Observable 对象。

Observable<Object>: an Observable of the body as an Object.


Overload #15

构造一个 OPTIONS 请求,这个请求会把 body 解释为 JSON ,并返回它。

Construct an OPTIONS request which interprets the body as JSON and returns it.

options<T>(url: string, options?: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe?: "body"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType?: "json"; withCredentials?: boolean; }): Observable<T>
      
      options<T>(url: string, options?: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe?: "body"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType?: "json"; withCredentials?: boolean; }): Observable<T>
    
参数
url string
options object

可选. 默认值是 undefined.

返回值

一个由 T 型的 body 组成的 Observable 对象。

Observable<T>: an Observable of the body as type T.

构造一个 Observable,当订阅它时,将导致服务器执行一个配置好的 PATCH 请求。 关于 patch() 返回类型的详细信息取决于所提供的选项,参见它的各个重载形式。

Constructs an Observable which, when subscribed, will cause the configured PATCH request to be executed on the server. See the individual overloads for details of patch()'s return type based on the provided options.

Overload #1

构造一个 PATCH 请求,这个请求会把 body 解释为 ArrayBuffer ,并返回它。

Construct a PATCH request which interprets the body as an ArrayBuffer and returns it.

patch(url: string, body: any, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe?: "body"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType: "arraybuffer"; withCredentials?: boolean; }): Observable<ArrayBuffer>
      
      patch(url: string, body: any, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe?: "body"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType: "arraybuffer"; withCredentials?: boolean; }): Observable<ArrayBuffer>
    
参数
url string
body any
options object
返回值

一个由 ArrayBuffer 型的 body 组成的 Observable 对象。

Observable<ArrayBuffer>: an Observable of the body as an ArrayBuffer.


Overload #2

构造一个 PATCH 请求,这个请求会把 body 解释为 Blob ,并返回它。

Construct a PATCH request which interprets the body as a Blob and returns it.

patch(url: string, body: any, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe?: "body"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType: "blob"; withCredentials?: boolean; }): Observable<Blob>
      
      patch(url: string, body: any, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe?: "body"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType: "blob"; withCredentials?: boolean; }): Observable<Blob>
    
参数
url string
body any
options object
返回值

一个由 Blob 型的 body 组成的 Observable 对象。

Observable<Blob>: an Observable of the body as a Blob.


Overload #3

构造一个 PATCH 请求,这个请求会把 body 解释为文本,并返回它。

Construct a PATCH request which interprets the body as text and returns it.

patch(url: string, body: any, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe?: "body"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType: "text"; withCredentials?: boolean; }): Observable<string>
      
      patch(url: string, body: any, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe?: "body"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType: "text"; withCredentials?: boolean; }): Observable<string>
    
参数
url string
body any
options object
返回值

一个由 string 型的 body 组成的 Observable 对象。

Observable<string>: an Observable of the body as a string.


Overload #4

构造一个 PATCH 请求,这个请求会把 body 解释为 ArrayBuffer ,并返回完整的事件流。

Construct a PATCH request which interprets the body as an ArrayBuffer and returns the full event stream.

patch(url: string, body: any, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe: "events"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType: "arraybuffer"; withCredentials?: boolean; }): Observable<HttpEvent<ArrayBuffer>>
      
      patch(url: string, body: any, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe: "events"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType: "arraybuffer"; withCredentials?: boolean; }): Observable<HttpEvent<ArrayBuffer>>
    
参数
url string
body any
options object
返回值

一个由该请求的所有 HttpEvents 组成的 Observable 对象,事件的 body 是 ArrayBuffer 型的。

Observable<HttpEvent<ArrayBuffer>>: an Observable of all HttpEvents for the request, with a body type of ArrayBuffer.


Overload #5

构造一个 PATCH 请求,这个请求会把 body 解释为 Blob ,并返回完整的事件流。

Construct a PATCH request which interprets the body as a Blob and returns the full event stream.

patch(url: string, body: any, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe: "events"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType: "blob"; withCredentials?: boolean; }): Observable<HttpEvent<Blob>>
      
      patch(url: string, body: any, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe: "events"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType: "blob"; withCredentials?: boolean; }): Observable<HttpEvent<Blob>>
    
参数
url string
body any
options object
返回值

一个由该请求的所有 HttpEvents 组成的 Observable 对象,事件的 body 是 Blob 型的。

Observable<HttpEvent<Blob>>: an Observable of all HttpEvents for the request, with a body type of Blob.


Overload #6

构造一个 PATCH 请求,这个请求会把 body 解释为文本,并返回完整的事件流。

Construct a PATCH request which interprets the body as text and returns the full event stream.

patch(url: string, body: any, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe: "events"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType: "text"; withCredentials?: boolean; }): Observable<HttpEvent<string>>
      
      patch(url: string, body: any, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe: "events"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType: "text"; withCredentials?: boolean; }): Observable<HttpEvent<string>>
    
参数
url string
body any
options object
返回值

一个由该请求的所有 HttpEvents 组成的 Observable 对象,事件的 body 是 string 型的。

Observable<HttpEvent<string>>: an Observable of all HttpEvents for the request, with a body type of string.


Overload #7

构造一个 PATCH 请求,这个请求会把 body 解释为 JSON ,并返回完整的事件流。

Construct a PATCH request which interprets the body as JSON and returns the full event stream.

patch(url: string, body: any, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe: "events"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType?: "json"; withCredentials?: boolean; }): Observable<HttpEvent<Object>>
      
      patch(url: string, body: any, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe: "events"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType?: "json"; withCredentials?: boolean; }): Observable<HttpEvent<Object>>
    
参数
url string
body any
options object
返回值

一个由该请求的所有 HttpEvents 组成的 Observable 对象,事件的 body 是 Object 型的。

Observable<HttpEvent<Object>>: an Observable of all HttpEvents for the request, with a body type of Object.


Overload #8

构造一个 PATCH 请求,这个请求会把 body 解释为 JSON ,并返回完整的事件流。

Construct a PATCH request which interprets the body as JSON and returns the full event stream.

patch<T>(url: string, body: any, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe: "events"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType?: "json"; withCredentials?: boolean; }): Observable<HttpEvent<T>>
      
      patch<T>(url: string, body: any, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe: "events"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType?: "json"; withCredentials?: boolean; }): Observable<HttpEvent<T>>
    
参数
url string
body any
options object
返回值

一个由该请求的所有 HttpEvents 组成的 Observable 对象,事件的 body 是 T 型的。

Observable<HttpEvent<T>>: an Observable of all HttpEvents for the request, with a body type of T.


Overload #9

构造一个 PATCH 请求,这个请求会把 body 解释为 ArrayBuffer ,并返回完整的响应体。

Construct a PATCH request which interprets the body as an ArrayBuffer and returns the full response.

patch(url: string, body: any, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe: "response"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType: "arraybuffer"; withCredentials?: boolean; }): Observable<HttpResponse<ArrayBuffer>>
      
      patch(url: string, body: any, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe: "response"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType: "arraybuffer"; withCredentials?: boolean; }): Observable<HttpResponse<ArrayBuffer>>
    
参数
url string
body any
options object
返回值

一个由该请求的 HttpResponse 组成的 Observable 对象,其 body 是 ArrayBuffer 型的。

Observable<HttpResponse<ArrayBuffer>>: an Observable of the HttpResponse for the request, with a body type of ArrayBuffer.


Overload #10

构造一个 PATCH 请求,这个请求会把 body 解释为 Blob ,并返回完整的响应体。

Construct a PATCH request which interprets the body as a Blob and returns the full response.

patch(url: string, body: any, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe: "response"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType: "blob"; withCredentials?: boolean; }): Observable<HttpResponse<Blob>>
      
      patch(url: string, body: any, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe: "response"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType: "blob"; withCredentials?: boolean; }): Observable<HttpResponse<Blob>>
    
参数
url string
body any
options object
返回值

一个由该请求的 HttpResponse 组成的 Observable 对象,其 body 是 Blob 型的。

Observable<HttpResponse<Blob>>: an Observable of the HttpResponse for the request, with a body type of Blob.


Overload #11

构造一个 PATCH 请求,这个请求会把 body 解释为文本,并返回完整的响应体。

Construct a PATCH request which interprets the body as text and returns the full response.

patch(url: string, body: any, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe: "response"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType: "text"; withCredentials?: boolean; }): Observable<HttpResponse<string>>
      
      patch(url: string, body: any, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe: "response"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType: "text"; withCredentials?: boolean; }): Observable<HttpResponse<string>>
    
参数
url string
body any
options object
返回值

一个由该请求的 HttpResponse 组成的 Observable 对象,其 body 是 string 型的。

Observable<HttpResponse<string>>: an Observable of the HttpResponse for the request, with a body type of string.


Overload #12

构造一个 PATCH 请求,这个请求会把 body 解释为 JSON ,并返回完整的响应体。

Construct a PATCH request which interprets the body as JSON and returns the full response.

patch(url: string, body: any, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe: "response"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType?: "json"; withCredentials?: boolean; }): Observable<HttpResponse<Object>>
      
      patch(url: string, body: any, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe: "response"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType?: "json"; withCredentials?: boolean; }): Observable<HttpResponse<Object>>
    
参数
url string
body any
options object
返回值

一个由该请求的 HttpResponse 组成的 Observable 对象,其 body 是 Object 型的。

Observable<HttpResponse<Object>>: an Observable of the HttpResponse for the request, with a body type of Object.


Overload #13

构造一个 PATCH 请求,这个请求会把 body 解释为 JSON ,并返回完整的响应体。

Construct a PATCH request which interprets the body as JSON and returns the full response.

patch<T>(url: string, body: any, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe: "response"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType?: "json"; withCredentials?: boolean; }): Observable<HttpResponse<T>>
      
      patch<T>(url: string, body: any, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe: "response"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType?: "json"; withCredentials?: boolean; }): Observable<HttpResponse<T>>
    
参数
url string
body any
options object
返回值

一个由该请求的 HttpResponse 组成的 Observable 对象,其 body 是 T 型的。

Observable<HttpResponse<T>>: an Observable of the HttpResponse for the request, with a body type of T.


Overload #14

构造一个 PATCH 请求,这个请求会把 body 解释为 JSON ,并返回它。

Construct a PATCH request which interprets the body as JSON and returns it.

patch(url: string, body: any, options?: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe?: "body"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType?: "json"; withCredentials?: boolean; }): Observable<Object>
      
      patch(url: string, body: any, options?: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe?: "body"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType?: "json"; withCredentials?: boolean; }): Observable<Object>
    
参数
url string
body any
options object

可选. 默认值是 undefined.

返回值

一个由 Object 型的 body 组成的 Observable 对象。

Observable<Object>: an Observable of the body as an Object.


Overload #15

构造一个 PATCH 请求,这个请求会把 body 解释为 JSON ,并返回它。

Construct a PATCH request which interprets the body as JSON and returns it.

patch<T>(url: string, body: any, options?: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe?: "body"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType?: "json"; withCredentials?: boolean; }): Observable<T>
      
      patch<T>(url: string, body: any, options?: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe?: "body"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType?: "json"; withCredentials?: boolean; }): Observable<T>
    
参数
url string
body any
options object

可选. 默认值是 undefined.

返回值

一个由 T 型的 body 组成的 Observable 对象。

Observable<T>: an Observable of the body as type T.

构造一个 Observable,当订阅它时,将导致服务器执行一个配置好的 POST 请求。 关于 post() 返回类型的详细信息取决于所提供的选项,参见它的各个重载形式。

Constructs an Observable which, when subscribed, will cause the configured POST request to be executed on the server. See the individual overloads for details of post()'s return type based on the provided options.

Overload #1

构造一个 POST 请求,这个请求会把 body 解释为 ArrayBuffer ,并返回它。

Construct a POST request which interprets the body as an ArrayBuffer and returns it.

post(url: string, body: any, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe?: "body"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType: "arraybuffer"; withCredentials?: boolean; }): Observable<ArrayBuffer>
      
      post(url: string, body: any, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe?: "body"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType: "arraybuffer"; withCredentials?: boolean; }): Observable<ArrayBuffer>
    
参数
url string
body any
options object
返回值

一个由 ArrayBuffer 型的 body 组成的 Observable 对象。

Observable<ArrayBuffer>: an Observable of the body as an ArrayBuffer.


Overload #2

构造一个 POST 请求,这个请求会把 body 解释为 Blob ,并返回它。

Construct a POST request which interprets the body as a Blob and returns it.

post(url: string, body: any, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe?: "body"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType: "blob"; withCredentials?: boolean; }): Observable<Blob>
      
      post(url: string, body: any, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe?: "body"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType: "blob"; withCredentials?: boolean; }): Observable<Blob>
    
参数
url string
body any
options object
返回值

一个由 Blob 型的 body 组成的 Observable 对象。

Observable<Blob>: an Observable of the body as a Blob.


Overload #3

构造一个 POST 请求,这个请求会把 body 解释为文本,并返回它。

Construct a POST request which interprets the body as text and returns it.

post(url: string, body: any, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe?: "body"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType: "text"; withCredentials?: boolean; }): Observable<string>
      
      post(url: string, body: any, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe?: "body"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType: "text"; withCredentials?: boolean; }): Observable<string>
    
参数
url string
body any
options object
返回值

一个由 string 型的 body 组成的 Observable 对象。

Observable<string>: an Observable of the body as a string.


Overload #4

构造一个 POST 请求,这个请求会把 body 解释为 ArrayBuffer ,并返回完整的事件流。

Construct a POST request which interprets the body as an ArrayBuffer and returns the full event stream.

post(url: string, body: any, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe: "events"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType: "arraybuffer"; withCredentials?: boolean; }): Observable<HttpEvent<ArrayBuffer>>
      
      post(url: string, body: any, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe: "events"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType: "arraybuffer"; withCredentials?: boolean; }): Observable<HttpEvent<ArrayBuffer>>
    
参数
url string
body any
options object
返回值

一个由该请求的所有 HttpEvents 组成的 Observable 对象,事件的 body 是 ArrayBuffer 型的。

Observable<HttpEvent<ArrayBuffer>>: an Observable of all HttpEvents for the request, with a body type of ArrayBuffer.


Overload #5

构造一个 POST 请求,这个请求会把 body 解释为 Blob ,并返回完整的事件流。

Construct a POST request which interprets the body as a Blob and returns the full event stream.

post(url: string, body: any, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe: "events"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType: "blob"; withCredentials?: boolean; }): Observable<HttpEvent<Blob>>
      
      post(url: string, body: any, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe: "events"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType: "blob"; withCredentials?: boolean; }): Observable<HttpEvent<Blob>>
    
参数
url string
body any
options object
返回值

一个由该请求的所有 HttpEvents 组成的 Observable 对象,事件的 body 是 Blob 型的。

Observable<HttpEvent<Blob>>: an Observable of all HttpEvents for the request, with a body type of Blob.


Overload #6

构造一个 POST 请求,这个请求会把 body 解释为文本,并返回完整的事件流。

Construct a POST request which interprets the body as text and returns the full event stream.

post(url: string, body: any, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe: "events"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType: "text"; withCredentials?: boolean; }): Observable<HttpEvent<string>>
      
      post(url: string, body: any, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe: "events"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType: "text"; withCredentials?: boolean; }): Observable<HttpEvent<string>>
    
参数
url string
body any
options object
返回值

一个由该请求的所有 HttpEvents 组成的 Observable 对象,事件的 body 是 string 型的。

Observable<HttpEvent<string>>: an Observable of all HttpEvents for the request, with a body type of string.


Overload #7

构造一个 POST 请求,这个请求会把 body 解释为 JSON ,并返回完整的事件流。

Construct a POST request which interprets the body as JSON and returns the full event stream.

post(url: string, body: any, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe: "events"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType?: "json"; withCredentials?: boolean; }): Observable<HttpEvent<Object>>
      
      post(url: string, body: any, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe: "events"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType?: "json"; withCredentials?: boolean; }): Observable<HttpEvent<Object>>
    
参数
url string
body any
options object
返回值

一个由该请求的所有 HttpEvents 组成的 Observable 对象,事件的 body 是 Object 型的。

Observable<HttpEvent<Object>>: an Observable of all HttpEvents for the request, with a body type of Object.


Overload #8

构造一个 POST 请求,这个请求会把 body 解释为 JSON ,并返回完整的事件流。

Construct a POST request which interprets the body as JSON and returns the full event stream.

post<T>(url: string, body: any, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe: "events"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType?: "json"; withCredentials?: boolean; }): Observable<HttpEvent<T>>
      
      post<T>(url: string, body: any, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe: "events"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType?: "json"; withCredentials?: boolean; }): Observable<HttpEvent<T>>
    
参数
url string
body any
options object
返回值

一个由该请求的所有 HttpEvents 组成的 Observable 对象,事件的 body 是 T 型的。

Observable<HttpEvent<T>>: an Observable of all HttpEvents for the request, with a body type of T.


Overload #9

构造一个 POST 请求,这个请求会把 body 解释为 ArrayBuffer ,并返回完整的响应体。

Construct a POST request which interprets the body as an ArrayBuffer and returns the full response.

post(url: string, body: any, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe: "response"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType: "arraybuffer"; withCredentials?: boolean; }): Observable<HttpResponse<ArrayBuffer>>
      
      post(url: string, body: any, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe: "response"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType: "arraybuffer"; withCredentials?: boolean; }): Observable<HttpResponse<ArrayBuffer>>
    
参数
url string
body any
options object
返回值

一个由该请求的 HttpResponse 组成的 Observable 对象,其 body 是 ArrayBuffer 型的。

Observable<HttpResponse<ArrayBuffer>>: an Observable of the HttpResponse for the request, with a body type of ArrayBuffer.


Overload #10

构造一个 POST 请求,这个请求会把 body 解释为 Blob ,并返回完整的响应体。

Construct a POST request which interprets the body as a Blob and returns the full response.

post(url: string, body: any, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe: "response"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType: "blob"; withCredentials?: boolean; }): Observable<HttpResponse<Blob>>
      
      post(url: string, body: any, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe: "response"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType: "blob"; withCredentials?: boolean; }): Observable<HttpResponse<Blob>>
    
参数
url string
body any
options object
返回值

一个由该请求的 HttpResponse 组成的 Observable 对象,其 body 是 Blob 型的。

Observable<HttpResponse<Blob>>: an Observable of the HttpResponse for the request, with a body type of Blob.


Overload #11

构造一个 POST 请求,这个请求会把 body 解释为文本,并返回完整的响应体。

Construct a POST request which interprets the body as text and returns the full response.

post(url: string, body: any, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe: "response"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType: "text"; withCredentials?: boolean; }): Observable<HttpResponse<string>>
      
      post(url: string, body: any, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe: "response"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType: "text"; withCredentials?: boolean; }): Observable<HttpResponse<string>>
    
参数
url string
body any
options object
返回值

一个由该请求的 HttpResponse 组成的 Observable 对象,其 body 是 string 型的。

Observable<HttpResponse<string>>: an Observable of the HttpResponse for the request, with a body type of string.


Overload #12

构造一个 POST 请求,这个请求会把 body 解释为 JSON ,并返回完整的响应体。

Construct a POST request which interprets the body as JSON and returns the full response.

post(url: string, body: any, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe: "response"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType?: "json"; withCredentials?: boolean; }): Observable<HttpResponse<Object>>
      
      post(url: string, body: any, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe: "response"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType?: "json"; withCredentials?: boolean; }): Observable<HttpResponse<Object>>
    
参数
url string
body any
options object
返回值

一个由该请求的 HttpResponse 组成的 Observable 对象,其 body 是 Object 型的。

Observable<HttpResponse<Object>>: an Observable of the HttpResponse for the request, with a body type of Object.


Overload #13

构造一个 POST 请求,这个请求会把 body 解释为 JSON ,并返回完整的响应体。

Construct a POST request which interprets the body as JSON and returns the full response.

post<T>(url: string, body: any, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe: "response"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType?: "json"; withCredentials?: boolean; }): Observable<HttpResponse<T>>
      
      post<T>(url: string, body: any, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe: "response"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType?: "json"; withCredentials?: boolean; }): Observable<HttpResponse<T>>
    
参数
url string
body any
options object
返回值

一个由该请求的 HttpResponse 组成的 Observable 对象,其 body 是 T 型的。

Observable<HttpResponse<T>>: an Observable of the HttpResponse for the request, with a body type of T.


Overload #14

构造一个 POST 请求,这个请求会把 body 解释为 JSON ,并返回它。

Construct a POST request which interprets the body as JSON and returns it.

post(url: string, body: any, options?: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe?: "body"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType?: "json"; withCredentials?: boolean; }): Observable<Object>
      
      post(url: string, body: any, options?: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe?: "body"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType?: "json"; withCredentials?: boolean; }): Observable<Object>
    
参数
url string
body any
options object

可选. 默认值是 undefined.

返回值

一个由 Object 型的 body 组成的 Observable 对象。

Observable<Object>: an Observable of the body as an Object.


Overload #15

构造一个 POST 请求,这个请求会把 body 解释为 JSON ,并返回它。

Construct a POST request which interprets the body as JSON and returns it.

post<T>(url: string, body: any, options?: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe?: "body"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType?: "json"; withCredentials?: boolean; }): Observable<T>
      
      post<T>(url: string, body: any, options?: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe?: "body"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType?: "json"; withCredentials?: boolean; }): Observable<T>
    
参数
url string
body any
options object

可选. 默认值是 undefined.

返回值

一个由 T 型的 body 组成的 Observable 对象。

Observable<T>: an Observable of the body as type T.

构造一个 Observable,当订阅它时,将导致服务器执行一个配置好的 PUT 请求。 关于 put() 返回类型的详细信息取决于所提供的选项,参见它的各个重载形式。

Constructs an Observable which, when subscribed, will cause the configured PUT request to be executed on the server. See the individual overloads for details of put()'s return type based on the provided options.

Overload #1

构造一个 PUT 请求,这个请求会把 body 解释为 ArrayBuffer ,并返回它。

Construct a PUT request which interprets the body as an ArrayBuffer and returns it.

put(url: string, body: any, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe?: "body"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType: "arraybuffer"; withCredentials?: boolean; }): Observable<ArrayBuffer>
      
      put(url: string, body: any, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe?: "body"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType: "arraybuffer"; withCredentials?: boolean; }): Observable<ArrayBuffer>
    
参数
url string
body any
options object
返回值

一个由 ArrayBuffer 型的 body 组成的 Observable 对象。

Observable<ArrayBuffer>: an Observable of the body as an ArrayBuffer.


Overload #2

构造一个 PUT 请求,这个请求会把 body 解释为 Blob ,并返回它。

Construct a PUT request which interprets the body as a Blob and returns it.

put(url: string, body: any, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe?: "body"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType: "blob"; withCredentials?: boolean; }): Observable<Blob>
      
      put(url: string, body: any, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe?: "body"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType: "blob"; withCredentials?: boolean; }): Observable<Blob>
    
参数
url string
body any
options object
返回值

一个由 Blob 型的 body 组成的 Observable 对象。

Observable<Blob>: an Observable of the body as a Blob.


Overload #3

构造一个 PUT 请求,这个请求会把 body 解释为文本,并返回它。

Construct a PUT request which interprets the body as text and returns it.

put(url: string, body: any, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe?: "body"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType: "text"; withCredentials?: boolean; }): Observable<string>
      
      put(url: string, body: any, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe?: "body"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType: "text"; withCredentials?: boolean; }): Observable<string>
    
参数
url string
body any
options object
返回值

一个由 string 型的 body 组成的 Observable 对象。

Observable<string>: an Observable of the body as a string.


Overload #4

构造一个 PUT 请求,这个请求会把 body 解释为 ArrayBuffer ,并返回完整的事件流。

Construct a PUT request which interprets the body as an ArrayBuffer and returns the full event stream.

put(url: string, body: any, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe: "events"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType: "arraybuffer"; withCredentials?: boolean; }): Observable<HttpEvent<ArrayBuffer>>
      
      put(url: string, body: any, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe: "events"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType: "arraybuffer"; withCredentials?: boolean; }): Observable<HttpEvent<ArrayBuffer>>
    
参数
url string
body any
options object
返回值

一个由该请求的所有 HttpEvents 组成的 Observable 对象,事件的 body 是 ArrayBuffer 型的。

Observable<HttpEvent<ArrayBuffer>>: an Observable of all HttpEvents for the request, with a body type of ArrayBuffer.


Overload #5

构造一个 PUT 请求,这个请求会把 body 解释为 Blob ,并返回完整的事件流。

Construct a PUT request which interprets the body as a Blob and returns the full event stream.

put(url: string, body: any, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe: "events"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType: "blob"; withCredentials?: boolean; }): Observable<HttpEvent<Blob>>
      
      put(url: string, body: any, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe: "events"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType: "blob"; withCredentials?: boolean; }): Observable<HttpEvent<Blob>>
    
参数
url string
body any
options object
返回值

一个由该请求的所有 HttpEvents 组成的 Observable 对象,事件的 body 是 Blob 型的。

Observable<HttpEvent<Blob>>: an Observable of all HttpEvents for the request, with a body type of Blob.


Overload #6

构造一个 PUT 请求,这个请求会把 body 解释为文本,并返回完整的事件流。

Construct a PUT request which interprets the body as text and returns the full event stream.

put(url: string, body: any, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe: "events"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType: "text"; withCredentials?: boolean; }): Observable<HttpEvent<string>>
      
      put(url: string, body: any, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe: "events"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType: "text"; withCredentials?: boolean; }): Observable<HttpEvent<string>>
    
参数
url string
body any
options object
返回值

一个由该请求的所有 HttpEvents 组成的 Observable 对象,事件的 body 是 string 型的。

Observable<HttpEvent<string>>: an Observable of all HttpEvents for the request, with a body type of string.


Overload #7

构造一个 PUT 请求,这个请求会把 body 解释为 JSON ,并返回完整的事件流。

Construct a PUT request which interprets the body as JSON and returns the full event stream.

put(url: string, body: any, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe: "events"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType?: "json"; withCredentials?: boolean; }): Observable<HttpEvent<Object>>
      
      put(url: string, body: any, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe: "events"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType?: "json"; withCredentials?: boolean; }): Observable<HttpEvent<Object>>
    
参数
url string
body any
options object
返回值

一个由该请求的所有 HttpEvents 组成的 Observable 对象,事件的 body 是 Object 型的。

Observable<HttpEvent<Object>>: an Observable of all HttpEvents for the request, with a body type of Object.


Overload #8

构造一个 PUT 请求,这个请求会把 body 解释为 JSON ,并返回完整的事件流。

Construct a PUT request which interprets the body as JSON and returns the full event stream.

put<T>(url: string, body: any, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe: "events"; responseType?: "json"; withCredentials?: boolean; }): Observable<HttpEvent<T>>
      
      put<T>(url: string, body: any, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe: "events"; responseType?: "json"; withCredentials?: boolean; }): Observable<HttpEvent<T>>
    
参数
url string
body any
options object
返回值

一个由该请求的所有 HttpEvents 组成的 Observable 对象,事件的 body 是 T 型的。

Observable<HttpEvent<T>>: an Observable of all HttpEvents for the request, with a body type of T.


Overload #9

构造一个 PUT 请求,这个请求会把 body 解释为 ArrayBuffer ,并返回完整的响应体。

Construct a PUT request which interprets the body as an ArrayBuffer and returns the full response.

put(url: string, body: any, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe: "response"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType: "arraybuffer"; withCredentials?: boolean; }): Observable<HttpResponse<ArrayBuffer>>
      
      put(url: string, body: any, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe: "response"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType: "arraybuffer"; withCredentials?: boolean; }): Observable<HttpResponse<ArrayBuffer>>
    
参数
url string
body any
options object
返回值

一个由该请求的 HttpResponse 组成的 Observable 对象,其 body 是 ArrayBuffer 型的。

Observable<HttpResponse<ArrayBuffer>>: an Observable of the HttpResponse for the request, with a body type of ArrayBuffer.


Overload #10

构造一个 PUT 请求,这个请求会把 body 解释为 Blob ,并返回完整的响应体。

Construct a PUT request which interprets the body as a Blob and returns the full response.

put(url: string, body: any, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe: "response"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType: "blob"; withCredentials?: boolean; }): Observable<HttpResponse<Blob>>
      
      put(url: string, body: any, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe: "response"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType: "blob"; withCredentials?: boolean; }): Observable<HttpResponse<Blob>>
    
参数
url string
body any
options object
返回值

一个由该请求的 HttpResponse 组成的 Observable 对象,其 body 是 Blob 型的。

Observable<HttpResponse<Blob>>: an Observable of the HttpResponse for the request, with a body type of Blob.


Overload #11

构造一个 PUT 请求,这个请求会把 body 解释为文本,并返回完整的响应体。

Construct a PUT request which interprets the body as text and returns the full response.

put(url: string, body: any, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe: "response"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType: "text"; withCredentials?: boolean; }): Observable<HttpResponse<string>>
      
      put(url: string, body: any, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe: "response"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType: "text"; withCredentials?: boolean; }): Observable<HttpResponse<string>>
    
参数
url string
body any
options object
返回值

一个由该请求的 HttpResponse 组成的 Observable 对象,其 body 是 string 型的。

Observable<HttpResponse<string>>: an Observable of the HttpResponse for the request, with a body type of string.


Overload #12

构造一个 PUT 请求,这个请求会把 body 解释为 JSON ,并返回完整的响应体。

Construct a PUT request which interprets the body as JSON and returns the full response.

put(url: string, body: any, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe: "response"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType?: "json"; withCredentials?: boolean; }): Observable<HttpResponse<Object>>
      
      put(url: string, body: any, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe: "response"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType?: "json"; withCredentials?: boolean; }): Observable<HttpResponse<Object>>
    
参数
url string
body any
options object
返回值

一个由该请求的 HttpResponse 组成的 Observable 对象,其 body 是 Object 型的。

Observable<HttpResponse<Object>>: an Observable of the HttpResponse for the request, with a body type of Object.


Overload #13

构造一个 PUT 请求,这个请求会把 body 解释为 JSON ,并返回完整的响应体。

Construct a PUT request which interprets the body as JSON and returns the full response.

put<T>(url: string, body: any, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe: "response"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType?: "json"; withCredentials?: boolean; }): Observable<HttpResponse<T>>
      
      put<T>(url: string, body: any, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe: "response"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType?: "json"; withCredentials?: boolean; }): Observable<HttpResponse<T>>
    
参数
url string
body any
options object
返回值

一个由该请求的 HttpResponse 组成的 Observable 对象,其 body 是 T 型的。

Observable<HttpResponse<T>>: an Observable of the HttpResponse for the request, with a body type of T.


Overload #14

构造一个 PUT 请求,这个请求会把 body 解释为 JSON ,并返回它。

Construct a PUT request which interprets the body as JSON and returns it.

put(url: string, body: any, options?: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe?: "body"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType?: "json"; withCredentials?: boolean; }): Observable<Object>
      
      put(url: string, body: any, options?: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe?: "body"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType?: "json"; withCredentials?: boolean; }): Observable<Object>
    
参数
url string
body any
options object

可选. 默认值是 undefined.

返回值

一个由 Object 型的 body 组成的 Observable 对象。

Observable<Object>: an Observable of the body as an Object.


Overload #15

构造一个 PUT 请求,这个请求会把 body 解释为 JSON ,并返回它。

Construct a PUT request which interprets the body as JSON and returns it.

put<T>(url: string, body: any, options?: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe?: "body"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType?: "json"; withCredentials?: boolean; }): Observable<T>
      
      put<T>(url: string, body: any, options?: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe?: "body"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType?: "json"; withCredentials?: boolean; }): Observable<T>
    
参数
url string
body any
options object

可选. 默认值是 undefined.

返回值

一个由 T 型的 body 组成的 Observable 对象。

Observable<T>: an Observable of the body as type T.