填写这份《一分钟调查》,帮我们(开发组)做得更好!去填写Home

HttpClient

Performs HTTP requests. This service is available as an injectable class, with methods to perform HTTP requests. Each request method has multiple signatures, and the return type varies based on the signature that is called (mainly the values of observe and responseType).

查看"说明"...

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" | ... 2 more ... | "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" | ... 2 more ... | "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" | ... 2 more ... | "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" | ... 2 more ... | "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" | ... 2 more ... | "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" | ... 2 more ... | "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" | ... 2 more ... | "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" | ... 2 more ... | "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" | ... 2 more ... | "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" | ... 2 more ... | "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" | ... 2 more ... | "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" | ... 2 more ... | "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" | ... 2 more ... | "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" | ... 2 more ... | "json"; withCredentials?: boolean; } = {}): Observable<any>
}
    

参见

说明

Note that the responseType options value is a String that identifies the single data type of the response. A single overload version of the method handles each response type. The value of responseType cannot be a union, as the combined signature could imply.

方法

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

Overload #1

Sends an HTTPRequest and returns 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>>: An Observable of the response, with the response body as a stream of HTTPEvents.


Overload #2

Constructs a request that interprets the body as an ArrayBuffer and returns the response in an 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>
      
      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

The HTTP method.

url string

The endpoint URL.

options object

The HTTP options to send with the request.

返回值

Observable<ArrayBuffer>: An Observable of the response, with the response body as an ArrayBuffer.


Overload #3

Constructs a request that interprets the body as a blob and returns the response as a 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>
      
      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

The HTTP method.

url string

The endpoint URL.

options object

The HTTP options to send with the request.

返回值

Observable<Blob>: An Observable of the response, with the response body of type Blob.


Overload #4

Constructs a request that interprets the body as a text string and returns a string value.

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

The HTTP method.

url string

The endpoint URL.

options object

The HTTP options to send with the request.

返回值

Observable<string>: An Observable of the response, with the response body of type string.


Overload #5

Constructs a request that interprets the body as an ArrayBuffer and returns the 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

The HTTP method.

url string

The endpoint URL.

options object

The HTTP options to send with the request.

返回值

Observable<HttpEvent<ArrayBuffer>>: An Observable of the response, with the response body as an array of HTTPEvents for the request.


Overload #6

Constructs a request that interprets the body as a 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

The HTTP method.

url string

The endpoint URL.

options object

The HTTP options to send with the request.

返回值

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


Overload #7

Constructs a request which interprets the body as a text string 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

The HTTP method.

url string

The endpoint URL.

options object

The HTTP options to send with the request.

返回值

Observable<HttpEvent<string>>: An Observable of all HttpEvents for the reques, with the response body of type string.


Overload #8

Constructs a request which interprets the body as a JSON object 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

The HTTP method.

url string

The endpoint URL.

options object

The HTTP options to send with the request.

返回值

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


Overload #9

Constructs a request which interprets the body as a JSON object 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

The HTTP method.

url string

The endpoint URL.

options object

The HTTP options to send with the request.

返回值

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


Overload #10

Constructs a request which interprets the body as an ArrayBuffer and returns the full HTTPResponse.

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

The HTTP method.

url string

The endpoint URL.

options object

The HTTP options to send with the request.

返回值

Observable<HttpResponse<ArrayBuffer>>: An Observable of the HTTPResponse, with the response body as an ArrayBuffer.


Overload #11

Constructs a request which interprets the body as a Blob and returns the full HTTPResponse.

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

The HTTP method.

url string

The endpoint URL.

options object

The HTTP options to send with the request.

返回值

Observable<HttpResponse<Blob>>: An Observable of the HTTPResponse, with the response body of type Blob.


Overload #12

Constructs a request which interprets the body as a text stream and returns the full HTTPResponse.

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

The HTTP method.

url string

The endpoint URL.

options object

The HTTP options to send with the request.

返回值

Observable<HttpResponse<string>>: An Observable of the HTTP response, with the response body of type string.


Overload #13

Constructs a request which interprets the body as a JSON object and returns the full HTTPResponse.

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

The HTTP method.

url string

The endpoint URL.

options object

The HTTP options to send with the request.

返回值

Observable<HttpResponse<Object>>: An Observable of the full HTTPResponse, with the response body of type Object.


Overload #14

Constructs a request which interprets the body as a JSON object and returns the full HTTPResponse with the response body in the requested type.

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

The HTTP method.

url string

The endpoint URL.

options object

The HTTP options to send with the request.

返回值

Observable<HttpResponse<R>>: An Observable of the full HTTPResponse, with the response body of type R.


Overload #15

Constructs a request which interprets the body as a JSON object and returns the full HTTPResponse as a JSON 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>
      
      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

The HTTP method.

url string

The endpoint URL.

options object

可选. 默认值是 undefined.

The HTTP options to send with the request.

返回值

Observable<Object>: An Observable of the HTTPResponse, with the response body of type Object.


Overload #16

Constructs a request which interprets the body as a JSON object with the response body of the requested type.

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

The HTTP method.

url string

The endpoint URL.

options object

可选. 默认值是 undefined.

The HTTP options to send with the request.

返回值

Observable<R>: An Observable of the HTTPResponse, with the response body of type R.


Overload #17

Constructs a request 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

The HTTP method.

url string

The endpoint URL.

options object

可选. 默认值是 undefined.

The HTTP options to send with the request.

返回值

Observable<any>: An Observable of the reuested response, wuth body of type any.

You can pass an HttpRequest directly as the only parameter. In this case, the call returns an observable of the raw HttpEvent stream.

Alternatively you can pass an HTTP method as the first parameter, a URL string as the second, and an options hash containing the request body as the third. See addBody(). In this case, the specified responseType and observe options determine the type of returned observable.

  • The responseType value determines how a successful response body is parsed.
  • If responseType is the default json, you can pass a type interface for the resulting object as a type parameter to the call.

The observe value determines the return type, according to what you are interested in observing.

  • An observe value of events returns an observable of the raw HttpEvent stream, including progress events by default.
  • An observe value of response returns an observable of HttpResponse<T>, where the T parameter depends on the responseType and any optionally provided type parameter.
  • An observe value of body returns an observable of <T> with the same T body type.

Constructs an observable that, when subscribed, causes the configured DELETE request to execute on the server. See the individual overloads for details on the return type.

Overload #1

Constructs a DELETE request that interprets the body as an ArrayBuffer and returns the response as an 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>
      
      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

The endpoint URL.

options object

The HTTP options to send with the request.

返回值

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


Overload #2

Constructs a DELETE request that interprets the body as a Blob and returns the response as a 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>
      
      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

The endpoint URL.

options object

The HTTP options to send with the request.

返回值

Observable<Blob>: An Observable of the response body as a Blob.


Overload #3

Constructs a DELETE request that interprets the body as a text string and returns a 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>
      
      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

The endpoint URL.

options object

The HTTP options to send with the request.

返回值

Observable<string>: An Observable of the response, with the response body of type string.


Overload #4

Constructs a DELETE request that 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

The endpoint URL.

options object

The HTTP options to send with the request.

返回值

Observable<HttpEvent<ArrayBuffer>>: An Observable of all HTTPEvents for the request, with response body as an ArrayBuffer.


Overload #5

Constructs a DELETE request that 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

The endpoint URL.

options object

The HTTP options to send with the request.

返回值

Observable<HttpEvent<Blob>>: An Observable of all the HTTPEvents for the request, with the response body as a Blob.


Overload #6

Constructs a DELETE request that interprets the body as a text string 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

The endpoint URL.

options object

The HTTP options to send with the request.

返回值

Observable<HttpEvent<string>>: An Observable of all HTTPEvents for the request, with the response body of type string.


Overload #7

Constructs a DELETE request that interprets the body as a JSON object 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

The endpoint URL.

options object

The HTTP options to send with the request.

返回值

Observable<HttpEvent<Object>>: An Observable of all HTTPEvents for the request, with response body of type Object.


Overload #8

Constructs a DELETErequest that interprets the body as a JSON object 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

The endpoint URL.

options object

The HTTP options to send with the request.

返回值

Observable<HttpEvent<T>>: An Observable of all the HTTPEvents for the request, with a response body in the requested type.


Overload #9

Constructs a DELETE request that interprets the body as an ArrayBuffer and returns the full HTTPResponse.

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

The endpoint URL.

options object

The HTTP options to send with the request.

返回值

Observable<HttpResponse<ArrayBuffer>>: An Observable of the full HTTPResponse, with the response body as an ArrayBuffer.


Overload #10

Constructs a DELETE request that interprets the body as a Blob and returns the full HTTPResponse.

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

The endpoint URL.

options object

The HTTP options to send with the request.

返回值

Observable<HttpResponse<Blob>>: An Observable of the HTTPResponse, with the response body of type Blob.


Overload #11

Constructs a DELETE request that interprets the body as a text stream and returns the full HTTPResponse.

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

The endpoint URL.

options object

The HTTP options to send with the request.

返回值

Observable<HttpResponse<string>>: An Observable of the full HTTPResponse, with the response body of type string.


Overload #12

Constructs a DELETE request the interprets the body as a JSON object and returns the full HTTPResponse.

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

The endpoint URL.

options object

The HTTP options to send with the request.

返回值

Observable<HttpResponse<Object>>: An Observable of the HTTPResponse, with the response body of type Object.


Overload #13

Constructs a DELETE request that interprets the body as a JSON object and returns the full HTTPResponse.

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

The endpoint URL.

options object

The HTTP options to send with the request.

返回值

Observable<HttpResponse<T>>: An Observable of the HTTPResponse, with the response body of the requested type.


Overload #14

Constructs a DELETE request that interprets the body as a JSON object and returns the response body as a JSON 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>
      
      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

The endpoint URL.

options object

可选. 默认值是 undefined.

The HTTP options to send with the request.

返回值

Observable<Object>: An Observable of the response, with the response body of type Object.


Overload #15

Constructs a DELETE request that interprets the body as a JSON object and returns the response in a given type.

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

The endpoint URL.

options object

可选. 默认值是 undefined.

The HTTP options to send with the request.

返回值

Observable<T>: An Observable of the HTTPResponse, with response body in the requested type.

Constructs an observable that, when subscribed, causes the configured GET request to execute on the server. See the individual overloads for details on the return type.

Overload #1

Constructs a GET request that interprets the body as an ArrayBuffer and returns the response in an 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>
      
      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

The endpoint URL.

options object

The HTTP options to send with the request.

返回值

Observable<ArrayBuffer>: An Observable of the response, with the response body as an ArrayBuffer.


Overload #2

Constructs a GET request that interprets the body as a Blob and returns the response as a 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>
      
      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

The endpoint URL.

options object

The HTTP options to send with the request.

返回值

Observable<Blob>: An Observable of the response, with the response body as a Blob.


Overload #3

Constructs a GET request that interprets the body as a text string and returns the response as a string value.

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

The endpoint URL.

options object

The HTTP options to send with the request.

返回值

Observable<string>: An Observable of the response, with the response body of type string.


Overload #4

Constructs a GET request that 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

The endpoint URL.

options object

The HTTP options to send with the request.

返回值

Observable<HttpEvent<ArrayBuffer>>: An Observable of all HttpEvents for the request, with the response body as an ArrayBuffer.


Overload #5

Constructs a GET request that 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

The endpoint URL.

options object

The HTTP options to send with the request.

返回值

Observable<HttpEvent<Blob>>: An Observable of the response, with the response body as a Blob.


Overload #6

Constructs a GET request that interprets the body as a text string 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

The endpoint URL.

options object

The HTTP options to send with the request.

返回值

Observable<HttpEvent<string>>: An Observable of the response, with the response body of type string.


Overload #7

Constructs a GET request that interprets the body as a JSON object 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

The endpoint URL.

options object

The HTTP options to send with the request.

返回值

Observable<HttpEvent<Object>>: An Observable of the response, with the response body of type Object.


Overload #8

Constructs a GET request that interprets the body as a JSON object 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

The endpoint URL.

options object

The HTTP options to send with the request.

返回值

Observable<HttpEvent<T>>: An Observable of the response, with a response body in the requested type.


Overload #9

Constructs a GET request that interprets the body as an ArrayBuffer and returns the full HTTPResponse.

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

The endpoint URL.

options object

The HTTP options to send with the request.

返回值

Observable<HttpResponse<ArrayBuffer>>: An Observable of the HTTPResponse for the request, with the response body as an ArrayBuffer.


Overload #10

Constructs a GET request that interprets the body as a Blob and returns the full HTTPResponse.

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

The endpoint URL.

options object

The HTTP options to send with the request.

返回值

Observable<HttpResponse<Blob>>: An Observable of the HTTPResponse for the request, with the response body as a Blob.


Overload #11

Constructs a GET request that interprets the body as a text stream and returns the full HTTPResponse.

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

The endpoint URL.

options object

The HTTP options to send with the request.

返回值

Observable<HttpResponse<string>>: An Observable of the HTTPResponse for the request, with the response body of type string.


Overload #12

Constructs a GET request that interprets the body as a JSON object and returns the full HTTPResponse.

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

The endpoint URL.

options object

The HTTP options to send with the request.

返回值

Observable<HttpResponse<Object>>: An Observable of the full HttpResponse, with the response body of type Object.


Overload #13

Constructs a GET request that interprets the body as a JSON object and returns the full HTTPResponse.

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

The endpoint URL.

options object

The HTTP options to send with the request.

返回值

Observable<HttpResponse<T>>: An Observable of the full HTTPResponse for the request, with a response body in the requested type.


Overload #14

Constructs a GET request that interprets the body as a JSON object and returns the response body as a JSON 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>
      
      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

The endpoint URL.

options object

可选. 默认值是 undefined.

The HTTP options to send with the request.

返回值

Observable<Object>: An Observable of the response body as a JSON object.


Overload #15

Constructs a GET request that interprets the body as a JSON object and returns the response body in a given type.

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

The endpoint URL.

options object

可选. 默认值是 undefined.

The HTTP options to send with the request.

返回值

Observable<T>: An Observable of the HTTPResponse, with a response body in the requested type.

Constructs an observable that, when subscribed, causes the configured HEAD request to execute on the server. The HEAD method returns meta information about the resource without transferring the resource itself. See the individual overloads for details on the return type.

Overload #1

Constructs a HEAD request that interprets the body as an ArrayBuffer and returns the response as an 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>
      
      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

The endpoint URL.

options object

The HTTP options to send with the request.

返回值

Observable<ArrayBuffer>: An Observable of the response, with the response body as an ArrayBuffer.


Overload #2

Constructs a HEAD request that interprets the body as a Blob and returns the response as a 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>
      
      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

The endpoint URL.

options object

The HTTP options to send with the request.

返回值

Observable<Blob>: An Observable of the response, with the response body as a Blob.


Overload #3

Constructs a HEAD request that interprets the body as a text string and returns the response as a string value.

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

The endpoint URL.

options object

The HTTP options to send with the request.

返回值

Observable<string>: An Observable of the response, with the response body of type string.


Overload #4

Constructs a HEAD request that 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

The endpoint URL.

options object

The HTTP options to send with the request.

返回值

Observable<HttpEvent<ArrayBuffer>>: An Observable of tall HttpEvents for the request, with the response body as an ArrayBuffer.


Overload #5

Constructs a HEAD request that 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

The endpoint URL.

options object

The HTTP options to send with the request.

返回值

Observable<HttpEvent<Blob>>: An Observable of all HttpEvents for the request, with the response body as a Blob.


Overload #6

Constructs a HEAD request that interprets the body as a text string 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

The endpoint URL.

options object

The HTTP options to send with the request.

返回值

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


Overload #7

Constructs a HEAD request that interprets the body as a JSON object and returns the full HTTP 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

The endpoint URL.

options object

The HTTP options to send with the request.

返回值

Observable<HttpEvent<Object>>: An Observable of all HTTPEvents for the request, with a response body of type Object.


Overload #8

Constructs a HEAD request that interprets the body as a JSON object 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

The endpoint URL.

options object

The HTTP options to send with the request.

返回值

Observable<HttpEvent<T>>: An Observable of all the HTTPEvents for the request , with a response body in the requested type.


Overload #9

Constructs a HEAD request that interprets the body as an ArrayBuffer and returns the full HTTP 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

The endpoint URL.

options object

The HTTP options to send with the request.

返回值

Observable<HttpResponse<ArrayBuffer>>: An Observable of the HTTPResponse for the request, with the response body as an ArrayBuffer.


Overload #10

Constructs a HEAD request that interprets the body as a Blob and returns the full HTTPResponse.

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

The endpoint URL.

options object

The HTTP options to send with the request.

返回值

Observable<HttpResponse<Blob>>: An Observable of the HTTPResponse for the request, with the response body as a blob.


Overload #11

Constructs a HEAD request that interprets the body as text stream and returns the full HTTPResponse.

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

The endpoint URL.

options object

The HTTP options to send with the request.

返回值

Observable<HttpResponse<string>>: An Observable of the HTTPResponse for the request, with the response body of type string.


Overload #12

Constructs a HEAD request that interprets the body as a JSON object and returns the full HTTPResponse.

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

The endpoint URL.

options object

The HTTP options to send with the request.

返回值

Observable<HttpResponse<Object>>: An Observable of the HTTPResponse for the request, with the response body of type Object.


Overload #13

Constructs a HEAD request that interprets the body as a JSON object and returns the full HTTPResponse.

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

The endpoint URL.

options object

The HTTP options to send with the request.

返回值

Observable<HttpResponse<T>>: An Observable of the HTTPResponse for the request, with a responmse body of the requested type.


Overload #14

Constructs a HEAD request that interprets the body as a JSON object and returns the response body as a JSON 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>
      
      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

The endpoint URL.

options object

可选. 默认值是 undefined.

The HTTP options to send with the request.

返回值

Observable<Object>: An Observable of the response, with the response body as a JSON object.


Overload #15

Constructs a HEAD request that interprets the body as a JSON object and returns the response in a given type.

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

The endpoint URL.

options object

可选. 默认值是 undefined.

The HTTP options to send with the request.

返回值

Observable<T>: An Observable of the HTTPResponse for the request, with a response body of the given type.

Constructs an Observable that, when subscribed, causes a request with the special method JSONP to be dispatched via the interceptor pipeline. The JSONP pattern works around limitations of certain API endpoints that don't support newer, and preferable CORS protocol. JSONP treats the endpoint API as a JavaScript file and tricks the browser to process the requests even if the API endpoint is not located on the same domain (origin) as the client-side application making the request. The endpoint API must support JSONP callback for JSONP requests to work. The resource API returns the JSON response wrapped in a callback function. You can pass the callback function name as one of the query parameters. Note that JSONP requests can only be used with GET requests.

Constructs 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

The resource URL.

callbackParam string

The callback function name.

返回值

Observable<Object>: An Observable of the response object, with response body as an object.

Constructs 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

The resource URL.

callbackParam string

The callback function name.

You must install a suitable interceptor, such as one provided by HttpClientJsonpModule. If no such interceptor is reached, then the JSONP request can be rejected by the configured backend.

返回值

Observable<T>: An Observable of the response object, with response body in the requested type.

Constructs an Observable that, when subscribed, causes the configured OPTIONS request to execute on the server. This method allows the client to determine the supported HTTP methods and other capabilites of an endpoint, without implying a resource action. See the individual overloads for details on the return type.

Overload #1

Constructs an OPTIONS request that interprets the body as an ArrayBuffer and returns the response as an 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>
      
      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

The endpoint URL.

options object

HTTP options.

返回值

Observable<ArrayBuffer>: An Observable of the response, with the response body as an ArrayBuffer.


Overload #2

Constructs an OPTIONS request that interprets the body as a Blob and returns the response as a 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>
      
      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

The endpoint URL.

options object

HTTP options.

返回值

Observable<Blob>: An Observable of the response, with the response body as a Blob.


Overload #3

Constructs an OPTIONS request that interprets the body as a text string and returns a string value.

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

The endpoint URL.

options object

HTTP options.

返回值

Observable<string>: An Observable of the response, with the response body of type string.


Overload #4

Constructs an OPTIONS request that 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

The endpoint URL.

options object

HTTP options.

返回值

Observable<HttpEvent<ArrayBuffer>>: An Observable of all HttpEvents for the request, with the response body as an ArrayBuffer.


Overload #5

Constructs an OPTIONS request that 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

The endpoint URL.

options object

HTTP options.

返回值

Observable<HttpEvent<Blob>>: An Observable of all HttpEvents for the request, with the response body as a Blob.


Overload #6

Constructs an OPTIONS request that interprets the body as a text string 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

The endpoint URL.

options object

HTTP options.

返回值

Observable<HttpEvent<string>>: An Observable of all the HTTPEvents for the request, with the response body of type string.


Overload #7

Constructs an OPTIONS request that interprets the body as a JSON object 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

The endpoint URL.

options object

HTTP options.

返回值

Observable<HttpEvent<Object>>: An Observable of all the HttpEvents for the request with the response body of type Object.


Overload #8

Constructs an OPTIONS request that interprets the body as a JSON object 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

The endpoint URL.

options object

HTTP options.

返回值

Observable<HttpEvent<T>>: An Observable of all the HttpEvents for the request, with a response body in the requested type.


Overload #9

Constructs an OPTIONS request that interprets the body as an ArrayBuffer and returns the full HTTP 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

The endpoint URL.

options object

HTTP options.

返回值

Observable<HttpResponse<ArrayBuffer>>: An Observable of the HttpResponse for the request, with the response body as an ArrayBuffer.


Overload #10

Constructs an OPTIONS request that interprets the body as a Blob and returns the full HTTPResponse.

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

The endpoint URL.

options object

HTTP options.

返回值

Observable<HttpResponse<Blob>>: An Observable of the HttpResponse for the request, with the response body as a Blob.


Overload #11

Constructs an OPTIONS request that interprets the body as text stream and returns the full HTTPResponse.

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

The endpoint URL.

options object

HTTP options.

返回值

Observable<HttpResponse<string>>: An Observable of the HttpResponse for the request, with the response body of type string.


Overload #12

Constructs an OPTIONS request that interprets the body as a JSON object and returns the full HTTPResponse.

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

The endpoint URL.

options object

HTTP options.

返回值

Observable<HttpResponse<Object>>: An Observable of the HttpResponse for the request, with the response body of type Object.


Overload #13

Constructs an OPTIONS request that interprets the body as a JSON object and returns the full HTTPResponse.

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

The endpoint URL.

options object

HTTP options.

返回值

Observable<HttpResponse<T>>: An Observable of the HttpResponse for the request, with a response body in the requested type.


Overload #14

Constructs an OPTIONS request that interprets the body as a JSON object and returns the response body as a JSON 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>
      
      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

The endpoint URL.

options object

可选. 默认值是 undefined.

HTTP options.

返回值

Observable<Object>: An Observable of the response, with the response body as a JSON object.


Overload #15

Constructs an OPTIONS request that interprets the body as a JSON object and returns the response in a given type.

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

The endpoint URL.

options object

可选. 默认值是 undefined.

HTTP options.

返回值

Observable<T>: An Observable of the HTTPResponse, with a response body of the given type.

Constructs an observable that, when subscribed, causes the configured PATCH request to execute on the server. See the individual overloads for details on the return type.

Overload #1

Constructs a PATCH request that interprets the body as an ArrayBuffer and returns the response as an 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>
      
      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

The endpoint URL.

body any

The resources to edit.

options object

HTTP options.

返回值

Observable<ArrayBuffer>: An Observable of the response, with the response body as an ArrayBuffer.


Overload #2

Constructs a PATCH request that interprets the body as a Blob and returns the response as a 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>
      
      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

The endpoint URL.

body any

The resources to edit.

options object

HTTP options.

返回值

Observable<Blob>: An Observable of the response, with the response body as a Blob.


Overload #3

Constructs a PATCH request that interprets the body as a text string and returns the response as a string value.

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

The endpoint URL.

body any

The resources to edit.

options object

HTTP options.

返回值

Observable<string>: An Observable of the response, with a response body of type string.


Overload #4

Constructs a PATCH request that interprets the body as an ArrayBuffer and returns the 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

The endpoint URL.

body any

The resources to edit.

options object

HTTP options.

返回值

Observable<HttpEvent<ArrayBuffer>>: An Observable of all the HTTPevents for the request, with the response body as an ArrayBuffer.


Overload #5

Constructs a PATCH request that 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

The endpoint URL.

body any

The resources to edit.

options object

HTTP options.

返回值

Observable<HttpEvent<Blob>>: An Observable of all the HTTPevents for the request, with the response body as Blob.


Overload #6

Constructs a PATCH request that interprets the body as a text string 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

The endpoint URL.

body any

The resources to edit.

options object

HTTP options.

返回值

Observable<HttpEvent<string>>: An Observable of all the HTTPeventsfor the request, with a response body of type string.


Overload #7

Constructs a PATCH request that interprets the body as a JSON object 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

The endpoint URL.

body any

The resources to edit.

options object

HTTP options.

返回值

Observable<HttpEvent<Object>>: An Observable of all the HTTPevents for the request, with a response body of type Object.


Overload #8

Constructs a PATCH request that interprets the body as a JSON object 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

The endpoint URL.

body any

The resources to edit.

options object

HTTP options.

返回值

Observable<HttpEvent<T>>: An Observable of all the HTTPevents for the request, with a response body in the requested type.


Overload #9

Constructs a PATCH request that interprets the body as an ArrayBuffer and returns the full HTTPResponse.

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

The endpoint URL.

body any

The resources to edit.

options object

HTTP options.

返回值

Observable<HttpResponse<ArrayBuffer>>: An Observable of the HttpResponse for the request, with the response body as an ArrayBuffer.


Overload #10

Constructs a PATCH request that interprets the body as a Blob and returns the full HTTPResponse.

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

The endpoint URL.

body any

The resources to edit.

options object

HTTP options.

返回值

Observable<HttpResponse<Blob>>: An Observable of the HttpResponse for the request, with the response body as a Blob.


Overload #11

Constructs a PATCH request that interprets the body as a text stream and returns the full HTTPResponse.

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

The endpoint URL.

body any

The resources to edit.

options object

HTTP options.

返回值

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


Overload #12

Constructs a PATCH request that interprets the body as a JSON object and returns the full HTTPResponse.

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

The endpoint URL.

body any

The resources to edit.

options object

HTTP options.

返回值

Observable<HttpResponse<Object>>: An Observable of the HttpResponse for the request, with a response body in the requested type.


Overload #13

Constructs a PATCH request that interprets the body as a JSON object and returns the full HTTPResponse.

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

The endpoint URL.

body any

The resources to edit.

options object

HTTP options.

返回值

Observable<HttpResponse<T>>: An Observable of the HttpResponse for the request, with a response body in the given type.


Overload #14

Constructs a PATCH request that interprets the body as a JSON object and returns the response body as a JSON 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>
      
      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

The endpoint URL.

body any

The resources to edit.

options object

可选. 默认值是 undefined.

HTTP options.

返回值

Observable<Object>: An Observable of the response, with the response body as a JSON object.


Overload #15

Constructs a PATCH request that interprets the body as a JSON object and returns the response in a given type.

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

The endpoint URL.

body any

The resources to edit.

options object

可选. 默认值是 undefined.

HTTP options.

返回值

Observable<T>: An Observable of the HttpResponse for the request, with a response body in the given type.

Constructs an observable that, when subscribed, causes the configured POST request to execute on the server. The server responds with the location of the replaced resource. See the individual overloads for details on the return type.

Overload #1

Constructs a POST request that interprets the body as an ArrayBuffer and returns an 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>
      
      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

The endpoint URL.

body any

The content to replace with.

options object

HTTP options.

返回值

Observable<ArrayBuffer>: An Observable of the response, with the response body as an ArrayBuffer.


Overload #2

Constructs a POST request that interprets the body as a Blob and returns the response as a 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>
      
      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

The endpoint URL.

body any

The content to replace with.

options object

HTTP options

返回值

Observable<Blob>: An Observable of the response, with the response body as a Blob.


Overload #3

Constructs a POST request that interprets the body as a text string and returns the response as a string value.

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

The endpoint URL.

body any

The content to replace with.

options object

HTTP options

返回值

Observable<string>: An Observable of the response, with a response body of type string.


Overload #4

Constructs a POST request that 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

The endpoint URL.

body any

The content to replace with.

options object

HTTP options

返回值

Observable<HttpEvent<ArrayBuffer>>: An Observable of all HttpEvents for the request, with the response body as an ArrayBuffer.


Overload #5

Constructs a POST request that interprets the body as a Blob and returns the response in an observable of 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

The endpoint URL.

body any

The content to replace with.

options object

HTTP options

返回值

Observable<HttpEvent<Blob>>: An Observable of all HttpEvents for the request, with the response body as Blob.


Overload #6

Constructs a POST request that interprets the body as a text string 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

The endpoint URL.

body any

The content to replace with.

options object

HTTP options

返回值

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


Overload #7

Constructs a POST request that interprets the body as a JSON object 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

The endpoint URL.

body any

The content to replace with.

options object

HTTP options

返回值

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


Overload #8

Constructs a POST request that interprets the body as a JSON object 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

The endpoint URL.

body any

The content to replace with.

options object

HTTP options

返回值

Observable<HttpEvent<T>>: An Observable of all HttpEvents for the request, with a response body in the requested type.


Overload #9

Constructs a POST request that interprets the body as an ArrayBuffer and returns the full HTTPresponse.

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

The endpoint URL.

body any

The content to replace with.

options object

HTTP options

返回值

Observable<HttpResponse<ArrayBuffer>>: An Observable of the HTTPResponse for the request, with the response body as an ArrayBuffer.


Overload #10

Constructs a POST request that interprets the body as a Blob and returns the full HTTPResponse.

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

The endpoint URL.

body any

The content to replace with.

options object

HTTP options

返回值

Observable<HttpResponse<Blob>>: An Observable of the HTTPResponse for the request, with the response body as a Blob.


Overload #11

Constructs a POST request that interprets the body as a text stream and returns the full HTTPResponse.

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

The endpoint URL.

body any

The content to replace with.

options object

HTTP options

返回值

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


Overload #12

Constructs a POST request that interprets the body as a JSON object and returns the full HTTPResponse.

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

The endpoint URL.

body any

The content to replace with.

options object

HTTP options

返回值

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


Overload #13

Constructs a POST request that interprets the body as a JSON object and returns the full HTTPResponse.

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

The endpoint URL.

body any

The content to replace with.

options object

HTTP options

返回值

Observable<HttpResponse<T>>: An Observable of the HTTPResponse for the request, with a response body in the requested type.


Overload #14

Constructs a POST request that interprets the body as a JSON object and returns the response body as a JSON 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>
      
      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

The endpoint URL.

body any

The content to replace with.

options object

可选. 默认值是 undefined.

HTTP options

返回值

Observable<Object>: An Observable of the response, with the response body as a JSON object.


Overload #15

Constructs a POST request that interprets the body as a JSON object and returns an observable of the response.

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

The endpoint URL.

body any

The content to replace with.

options object

可选. 默认值是 undefined.

HTTP options

返回值

Observable<T>: An Observable of the HTTPResponse for the request, with a response body in the requested type.

Constructs an observable that, when subscribed, causes the configured PUT request to execute on the server. The PUT method replaces an existing resource with a new set of values. See the individual overloads for details on the return type.

Overload #1

Constructs a PUT request that interprets the body as an ArrayBuffer and returns the response as an 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>
      
      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

The endpoint URL.

body any

The resources to add/update.

options object

HTTP options

返回值

Observable<ArrayBuffer>: An Observable of the response, with the response body as an ArrayBuffer.


Overload #2

Constructs a PUT request that interprets the body as a Blob and returns the response as a 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>
      
      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

The endpoint URL.

body any

The resources to add/update.

options object

HTTP options

返回值

Observable<Blob>: An Observable of the response, with the response body as a Blob.


Overload #3

Constructs a PUT request that interprets the body as a text string and returns the response as a string value.

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

The endpoint URL.

body any

The resources to add/update.

options object

HTTP options

返回值

Observable<string>: An Observable of the response, with a response body of type string.


Overload #4

Constructs a PUT request that 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

The endpoint URL.

body any

The resources to add/update.

options object

HTTP options

返回值

Observable<HttpEvent<ArrayBuffer>>: An Observable of all HttpEvents for the request, with the response body as an ArrayBuffer.


Overload #5

Constructs a PUT request that 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

The endpoint URL.

body any

The resources to add/update.

options object

HTTP options

返回值

Observable<HttpEvent<Blob>>: An Observable of all HttpEvents for the request, with the response body as a Blob.


Overload #6

Constructs a PUT request that interprets the body as a text string 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

The endpoint URL.

body any

The resources to add/update.

options object

HTTP options

返回值

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


Overload #7

Constructs a PUT request that interprets the body as a JSON object 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

The endpoint URL.

body any

The resources to add/update.

options object

HTTP options

返回值

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


Overload #8

Constructs a PUT request that interprets the body as a JSON object 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

The endpoint URL.

body any

The resources to add/update.

options object

HTTP options

返回值

Observable<HttpEvent<T>>: An Observable of all HttpEvents for the request, with a response body in the requested type.


Overload #9

Constructs a PUT request that interprets the body as an ArrayBuffer and returns an observable of the full HTTP 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

The endpoint URL.

body any

The resources to add/update.

options object

HTTP options

返回值

Observable<HttpResponse<ArrayBuffer>>: An Observable of the HTTPResponse for the request, with the response body as an ArrayBuffer.


Overload #10

Constructs a PUT request that interprets the body as a Blob and returns the full HTTP 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

The endpoint URL.

body any

The resources to add/update.

options object

HTTP options

返回值

Observable<HttpResponse<Blob>>: An Observable of the HTTPResponse for the request, with the response body as a Blob.


Overload #11

Constructs a PUT request that interprets the body as a text stream and returns the full HTTP 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

The endpoint URL.

body any

The resources to add/update.

options object

HTTP options

返回值

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


Overload #12

Constructs a PUT request that interprets the body as a JSON object and returns the full HTTP 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

The endpoint URL.

body any

The resources to add/update.

options object

HTTP options

返回值

Observable<HttpResponse<Object>>: An Observable of the HTTPResponse for the request, with a response body of type 'Object`.


Overload #13

Constructs a PUT request that interprets the body as a JSON object and returns the full HTTP 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

The endpoint URL.

body any

The resources to add/update.

options object

HTTP options

返回值

Observable<HttpResponse<T>>: An Observable of the HTTPResponse for the request, with a response body in the requested type.


Overload #14

Constructs a PUT request that interprets the body as a JSON object and returns the response body as a JSON 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>
      
      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

The endpoint URL.

body any

The resources to add/update.

options object

可选. 默认值是 undefined.

HTTP options

返回值

Observable<Object>: An Observable of the response, with the response body as a JSON object.


Overload #15

Constructs a PUT request that interprets the body as a JSON object and returns an observable of the response.

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

The endpoint URL.

body any

The resources to add/update.

options object

可选. 默认值是 undefined.

HTTP options

返回值

Observable<T>: An Observable of the HTTPResponse for the request, with a response body in the requested type.

使用说明

Sample HTTP requests for the Tour of Heroes application.

HTTP Request Example

// GET heroes whose name contains search term searchHeroes(term: string): observable<Hero[]>{ const params = new HttpParams({fromString: 'name=term'}); return this.httpClient.request('GET', this.heroesUrl, {responseType:'json', params}); }
      
      // GET heroes whose name contains search term
searchHeroes(term: string): observable<Hero[]>{

 const params = new HttpParams({fromString: 'name=term'});
   return this.httpClient.request('GET', this.heroesUrl, {responseType:'json', params});
}
    

JSONP Example

requestJsonp(url, callback = 'callback') { return this.httpClient.jsonp(this.heroesURL, callback); }
      
      requestJsonp(url, callback = 'callback') {
 return this.httpClient.jsonp(this.heroesURL, callback);
}
    

PATCH Example

// PATCH one of the heroes' name patchHero (id: number, heroName: string): Observable<{}> { const url = `${this.heroesUrl}/${id}`; // PATCH api/heroes/42 return this.httpClient.patch(url, {name: heroName}, httpOptions) .pipe(catchError(this.handleError('patchHero'))); }
      
      // PATCH one of the heroes' name
patchHero (id: number, heroName: string): Observable<{}> {
const url = `${this.heroesUrl}/${id}`;   // PATCH api/heroes/42
 return this.httpClient.patch(url, {name: heroName}, httpOptions)
   .pipe(catchError(this.handleError('patchHero')));
}