填寫這份《一分鐘調查》,幫我們(開發組)做得更好!去填寫Home

HttpClient

執行 HTTP 請求。該服務作為可注入類別提供,帶有執行 HTTP 請求的方法。每個請求方法都有多個簽名,並且返回型別會根據所呼叫的簽名(主要的值是 observeresponseType)而有所不同。

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>
}
    

參見

說明

請注意, responseType 選項的值是一個字串,用於標識此響應的單一資料型別。該方法的各個過載版本處理每種響應型別。正如組合簽名所暗示的那樣 responseType 的值不能為聯合型別。

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.

方法

為任意 HTTP 請求構造一個可觀察的物件,該請求在被訂閱時將透過已註冊的攔截器鏈觸發該請求,然後傳送到伺服器。

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.

17 個過載形式...

顯示所有 隱藏所有 expand_more
Overload #1

傳送 HTTPRequest 並返回 HTTPEvents 流。

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 ,其回應內文為 HTTPEvents 流。

Observable<HttpEvent<R>>: An Observable of the response, with the response body as a stream of HTTPEvents.


Overload #2

構造一個請求,它將請求體解釋為 ArrayBuffer,並且返回 ArrayBuffer 格式的回應內文。

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

HTTP 方法。

The HTTP method.

url string

端點 URL。

The endpoint URL.

options object

與請求一起傳送的 HTTP 選項。

The HTTP options to send with the request.

返回值

響應物件的 Observable,其回應內文為 ArrayBuffer 型別。

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


Overload #3

構造一個請求,將請求體解釋為 Blob 型別,其回應內文為 Blob 型別。

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

HTTP 方法。

The HTTP method.

url string

端點 URL。

The endpoint URL.

options object

與請求一起傳送的 HTTP 選項。

The HTTP options to send with the request.

返回值

此請求的響應物件的 Observable,其回應內文為 Blob 型別。

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

HTTP 方法。

The HTTP method.

url string

端點 URL。

The endpoint URL.

options object

與請求一起傳送的 HTTP 選項。

The HTTP options to send with the request.

返回值

此請求的響應物件的 Observable,其回應內文為 string 型別。

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


Overload #5

構造一個請求,它將請求體解釋為 ArrayBuffer,並返回完整的事件流。

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

HTTP 方法。

The HTTP method.

url string

端點 URL。

The endpoint URL.

options object

與請求一起傳送的 HTTP 選項。

The HTTP options to send with the request.

返回值

一個響應物件的 Observable,其響應主體為此請求的 HTTPEvents

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


Overload #6

構造一個請求,它將請求體解釋為 Blob,並返回完整的事件流。

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

HTTP 方法。

The HTTP method.

url string

端點 URL。

The endpoint URL.

options object

與請求一起傳送的 HTTP 選項。

The HTTP options to send with the request.

返回值

此請求的 HttpEventsObservable,其回應內文為 Blob 型別。

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

HTTP 方法。

The HTTP method.

url string

端點 URL。

The endpoint URL.

options object

與請求一起傳送的 HTTP 選項。

The HTTP options to send with the request.

返回值

此請求的 HttpEventsObservable,其回應內文為 string 型別。

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


Overload #8

構造一個請求,它將請求體解釋為 JSON 物件,並且返回完整的 HTTP 事件流。

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

HTTP 方法。

The HTTP method.

url string

端點 URL。

The endpoint URL.

options object

要和此請求一起傳送的 HTTP 選項。

The HTTP options to send with the request.

返回值

此請求的 HttpEventsObservable,其回應內文為 Object 型別。

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


Overload #9

構造一個請求,它將請求體解釋為 JSON 物件,並且返回完整的 HTTP 事件流。

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

HTTP 方法。

The HTTP method.

url string

端點 URL。

The endpoint URL.

options object

與請求一起傳送的 HTTP 選項。

The HTTP options to send with the request.

返回值

此請求的 HttpEventsObservable,其回應內文為 R 型別。

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


Overload #10

構造一個請求,它將請求體解釋為 ArrayBuffer,並且返回完整的 HttpResponse

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

HTTP 方法。

The HTTP method.

url string

端點 URL。

The endpoint URL.

options object

與請求一起傳送的 HTTP 選項。

The HTTP options to send with the request.

返回值

此請求的響應物件的 Observable,其回應內文為 ArrayBuffer 型別。

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


Overload #11

構造一個請求,它將請求體解釋為 Blob,並且返回完整的 HttpResponse

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

HTTP 方法。

The HTTP method.

url string

端點 URL。

The endpoint URL.

options object

與請求一起傳送的 HTTP 選項。

The HTTP options to send with the request.

返回值

此請求的響應物件的 Observable,其回應內文為 Blob 型別。

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


Overload #12

構造一個請求,它將請求體解釋為文字流,並且返回完整的 HttpResponse

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

HTTP 方法。

The HTTP method.

url string

端點 URL。

The endpoint URL.

options object

與請求一起傳送的 HTTP 選項。

The HTTP options to send with the request.

返回值

此請求的 HTTP responseObservable,其回應內文為 string 型別。

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


Overload #13

構造一個請求,它將請求體解釋為 JSON 物件,並返回完整 HTTPResponse

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

HTTP 方法。

The HTTP method.

url string

端點 URL。

The endpoint URL.

options object

與請求一起傳送的 HTTP 選項。

The HTTP options to send with the request.

返回值

此請求的完整 HTTPResponseObservable,其回應內文為 Object 型別。

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


Overload #14

構造一個請求,它將請求體解釋為 JSON 物件,並返回帶有請求主體型別 HTTPResponse

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

HTTP 方法。

The HTTP method.

url string

端點 URL。

The endpoint URL.

options object

與請求一起傳送的 HTTP 選項。

The HTTP options to send with the request.

返回值

此請求的完整 HTTPResponseObservable,其回應內文為 R 型別。

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


Overload #15

構造一個請求,它將請求體解釋為 JSON 物件,並返回完整的 HTTPResponse

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

HTTP 方法。

The HTTP method.

url string

端點 URL。

The endpoint URL.

options object

與請求一起傳送的 HTTP 選項。

The HTTP options to send with the request.

可選. 預設值是 `undefined`.
返回值

此請求的響應物件的 Observable,其回應內文為 Object 型別。

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


Overload #16

構造一個請求,它將請求體解釋為 JSON 物件,並返回所請求型別的回應內文。

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

HTTP 方法。

The HTTP method.

url string

端點 URL。

The endpoint URL.

options object

與請求一起傳送的 HTTP 選項。

The HTTP options to send with the request.

可選. 預設值是 `undefined`.
返回值

此請求的響應物件的 Observable,其回應內文為 R 型別。

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

HTTP 方法。

The HTTP method.

url string

端點 URL。

The endpoint URL.

options object

與請求一起傳送的 HTTP 選項。

The HTTP options to send with the request.

可選. 預設值是 `undefined`.
返回值

所請求的響應物件的 Observable,其回應內文是 any 型別。

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

你可以直接把 HttpRequest 作為唯一引數。在這種情況下,該呼叫將返回原始 HttpEvent 流的可觀察值。

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

或者,你可以將 HTTP 方法作為第一個引數,將 URL 字串作為第二個引數,將包含請求正文的選項雜湊作為第三個引數。參見 addBody()。在這種情況下,指定的 responseTypeobserve 選項會決定要返回的 observable 型別。

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.

  • responseType 值確定如何解析成功的回應內文。

    The responseType value determines how a successful response body is parsed.

  • 如果 responseType 是預設的 json ,則可以將結果物件的型別介面作為型別引數傳遞給呼叫。

    If responseType is the default json, you can pass a type interface for the resulting object as a type parameter to the call.

observe 值根據你感興趣的觀察值確定其返回型別。

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

  • 事件的 observe 值返回原始 HttpEvent 流的可觀察值,預設情況下包括進度事件。

    An observe value of events returns an observable of the raw HttpEvent stream, including progress events by default.

  • 響應物件的 observe 值返回 HttpResponse<T> 的可觀察物件,其中 T 引數取決於 responseType 和所提供的可選型別引數。

    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.

  • observe 的 body 值會返回與 T 的回應內文具有相同型別的 <T> 型可觀察物件。

    An observe value of body returns an observable of <T> with the same T body type.

構造一個 Observable,當它被訂閱時,會要求伺服器執行配置好的 DELETE 請求。參見它的各個獨立過載形式,以瞭解其返回值型別。

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.

15 個過載形式...

顯示所有 隱藏所有 expand_more
Overload #1

構造一個 DELETE 請求,它將請求體解釋為 ArrayBuffer,並且返回 ArrayBuffer 格式的回應內文。

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

端點 URL。

The endpoint URL.

options object

與請求一起傳送的 HTTP 選項。

The HTTP options to send with the request.

返回值

型別為 ArrayBuffer 的回應內文的 Observable

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


Overload #2

構造一個 DELETE 請求,它將請求體解釋為 Blob,並且返回 Blob 格式的回應內文。

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

端點 URL。

The endpoint URL.

options object

與請求一起傳送的 HTTP 選項。

The HTTP options to send with the request.

返回值

型別為 Blob 的回應內文的 Observable

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


Overload #3

構造一個 DELETE 請求,它將請求體解釋為字串,並且返回一個字串。

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

端點 URL。

The endpoint URL.

options object

與請求一起傳送的 HTTP 選項。

The HTTP options to send with the request.

返回值

此請求的響應物件的 Observable,其回應內文為 string 型別。

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


Overload #4

構造一個 DELETE 請求,它將請求體解釋為 ArrayBuffer,並返回完整的事件流。

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

端點 URL。

The endpoint URL.

options object

與請求一起傳送的 HTTP 選項。

The HTTP options to send with the request.

返回值

此請求的所有 HTTPEventsObservable,其回應內文為 ArrayBuffer 型別。

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


Overload #5

構造一個 DELETE 請求,它將請求體解釋為 Blob,並返回完整的事件流。

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

端點 URL。

The endpoint URL.

options object

與請求一起傳送的 HTTP 選項。

The HTTP options to send with the request.

返回值

此請求的所有 HTTPEventsObservable,其回應內文為 Blob 型別。

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


Overload #6

構造一個 DELETE 請求,它將請求體解釋為文字字串,並且返回完整的事件流。

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

端點 URL。

The endpoint URL.

options object

與請求一起傳送的 HTTP 選項。

The HTTP options to send with the request.

返回值

表示啥此請求的 HTTPEventsObservable,回應內文為 string 型別。

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


Overload #7

構造一個 DELETE 請求,它將請求體解釋為 JSON 物件,並且返回完整的 HTTP 事件流。

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

端點 URL。

The endpoint URL.

options object

與請求一起傳送的 HTTP 選項。

The HTTP options to send with the request.

返回值

表示啥此請求的 HTTPEventsObservable,回應內文為 Object 型別。

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


Overload #8

構造一個 DELETE 請求,它將請求體解釋為 JSON 物件,並且返回完整的 HTTP 事件流。

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

端點 URL。

The endpoint URL.

options object

與請求一起傳送的 HTTP 選項。

The HTTP options to send with the request.

返回值

表示此請求的 HTTPEventsObservable,回應內文為所請求的型別。

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


Overload #9

構造一個 DELETE 請求,它將請求體解釋為 ArrayBuffer,並且返回完整的 HttpResponse

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

端點 URL。

The endpoint URL.

options object

與請求一起傳送的 HTTP 選項。

The HTTP options to send with the request.

返回值

此請求的完整 HTTPResponseObservable,其回應內文為 ArrayBuffer 型別。

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


Overload #10

構造一個 DELETE 請求,它將請求體解釋為 Blob,並且返回完整的 HttpResponse

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

端點 URL。

The endpoint URL.

options object

與請求一起傳送的 HTTP 選項。

The HTTP options to send with the request.

返回值

此請求的響應物件的 Observable,其回應內文為 Blob 型別。

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


Overload #11

構造一個 DELETE 請求,它將請求體解釋為文字流,並且返回完整的 HttpResponse

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

端點 URL。

The endpoint URL.

options object

與請求一起傳送的 HTTP 選項。

The HTTP options to send with the request.

返回值

此請求的完整 HTTPResponseObservable,其回應內文為 string 型別。

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


Overload #12

構造一個 DELETE 請求,它將請求體解釋為 JSON 物件,並且返回完整的 HttpResponse

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

端點 URL。

The endpoint URL.

options object

與請求一起傳送的 HTTP 選項。

The HTTP options to send with the request.

返回值

此請求的響應物件的 Observable,其回應內文為 Object 型別。

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


Overload #13

構造一個 DELETE 請求,它將請求體解釋為 JSON 物件,並且返回完整的 HttpResponse

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

端點 URL。

The endpoint URL.

options object

與請求一起傳送的 HTTP 選項。

The HTTP options to send with the request.

返回值

此請求的響應物件的 Observable,其回應內文為所請求的型別。

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


Overload #14

構造一個 DELETE 請求,它將請求體解釋為 JSON 物件,並且返回 JSON 物件格式的回應內文。

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

端點 URL。

The endpoint URL.

options object

與請求一起傳送的 HTTP 選項。

The HTTP options to send with the request.

可選. 預設值是 `undefined`.
返回值

此請求的響應物件的 Observable,其回應內文為 Object 型別。

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


Overload #15

構造一個 DELETE 請求,它將請求體解釋為 JSON 物件,並且返回給定型別的響應。

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

端點 URL。

The endpoint URL.

options object

與請求一起傳送的 HTTP 選項。

The HTTP options to send with the request.

可選. 預設值是 `undefined`.
返回值

此請求的響應物件的 Observable,其回應內文為所請求的型別。

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

構造一個 Observable,當它被訂閱時,會要求伺服器執行配置好的 GET 請求。參見它的各個獨立過載形式,以瞭解其返回值型別。

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.

15 個過載形式...

顯示所有 隱藏所有 expand_more
Overload #1

構造一個 GET 請求,它將請求體解釋為 ArrayBuffer,並且返回 ArrayBuffer 格式的回應內文。

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

端點 URL。

The endpoint URL.

options object

與請求一起傳送的 HTTP 選項。

The HTTP options to send with the request.

返回值

響應物件的 Observable,其回應內文為 ArrayBuffer 型別。

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


Overload #2

構造一個 GET 請求,它將請求體解釋為 Blob,並且返回 Blob 格式的回應內文。

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

端點 URL。

The endpoint URL.

options object

與請求一起傳送的 HTTP 選項。

The HTTP options to send with the request.

返回值

響應物件的 Observable ,其回應內文為 Blob 型別。

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


Overload #3

構造一個 GET 請求,它將請求體解釋為字串,並且返回字串格式的響應。

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

端點 URL。

The endpoint URL.

options object

與請求一起傳送的 HTTP 選項。

The HTTP options to send with the request.

返回值

此請求的響應物件的 Observable,其回應內文為 string 型別。

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


Overload #4

構造一個 GET 請求,它將請求體解釋為 ArrayBuffer,並返回完整的事件流。

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

端點 URL。

The endpoint URL.

options object

與請求一起傳送的 HTTP 選項。

The HTTP options to send with the request.

返回值

表示此請求的 HttpEventsObservable,回應內文為 n ArrayBuffer 型別。

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


Overload #5

構造一個 GET 請求,它將請求體解釋為 Blob,並返回完整的事件流。

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

端點 URL。

The endpoint URL.

options object

與請求一起傳送的 HTTP 選項。

The HTTP options to send with the request.

返回值

響應物件的 Observable ,其回應內文為 Blob 型別。

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


Overload #6

構造一個 GET 請求,它將請求體解釋為文字字串,並且返回完整的事件流。

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

端點 URL。

The endpoint URL.

options object

與請求一起傳送的 HTTP 選項。

The HTTP options to send with the request.

返回值

此請求的響應物件的 Observable,其回應內文為 string 型別。

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


Overload #7

構造一個 GET 請求,它將請求體解釋為 JSON 物件,並且返回完整的 HTTP 事件流。

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

端點 URL。

The endpoint URL.

options object

與請求一起傳送的 HTTP 選項。

The HTTP options to send with the request.

返回值

此請求的響應物件的 Observable,其回應內文為 Object 型別。

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


Overload #8

構造一個 GET 請求,它將請求體解釋為 JSON 物件,並且返回完整的 HTTP 事件流。

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

端點 URL。

The endpoint URL.

options object

與請求一起傳送的 HTTP 選項。

The HTTP options to send with the request.

返回值

響應物件的 Observable ,其回應內文為所請求的型別。

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


Overload #9

構造一個 GET 請求,它將請求體解釋為 ArrayBuffer,並且返回完整的 HttpResponse

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

端點 URL。

The endpoint URL.

options object

與請求一起傳送的 HTTP 選項。

The HTTP options to send with the request.

返回值

此請求的響應物件的 Observable,其回應內文為 ArrayBuffer 型別。

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


Overload #10

構造一個 GET 請求,它將請求體解釋為 Blob,並且返回完整的 HttpResponse

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

端點 URL。

The endpoint URL.

options object

與請求一起傳送的 HTTP 選項。

The HTTP options to send with the request.

返回值

此請求的響應物件的 Observable,其回應內文為 Blob 型別。

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


Overload #11

構造一個 GET 請求,它將請求體解釋為文字流,並且返回完整的 HttpResponse

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

端點 URL。

The endpoint URL.

options object

與請求一起傳送的 HTTP 選項。

The HTTP options to send with the request.

返回值

此請求的響應物件的 Observable,其回應內文為 string 型別。

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


Overload #12

構造一個 GET 請求,它將請求體解釋為 JSON 物件,並且返回完整的 HttpResponse

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

端點 URL。

The endpoint URL.

options object

與請求一起傳送的 HTTP 選項。

The HTTP options to send with the request.

返回值

此請求的完整 HttpResponseObservable,其回應內文為 Object 型別。

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


Overload #13

構造一個 GET 請求,它將請求體解釋為 JSON 物件,並且返回完整的 HttpResponse

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

端點 URL。

The endpoint URL.

options object

與請求一起傳送的 HTTP 選項。

The HTTP options to send with the request.

返回值

此請求的完整 HTTPResponseObservable,其回應內文為所請求的型別。

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


Overload #14

構造一個 GET 請求,它將請求體解釋為 JSON 物件,並且返回 JSON 物件格式的回應內文。

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

端點 URL。

The endpoint URL.

options object

與請求一起傳送的 HTTP 選項。

The HTTP options to send with the request.

可選. 預設值是 `undefined`.
返回值

回應內文的 Observable 作為 JSON 物件。

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


Overload #15

構造一個 GET 請求,它將請求體解釋為 JSON 物件,並且返回給定型別的回應內文。

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

端點 URL。

The endpoint URL.

options object

與請求一起傳送的 HTTP 選項。

The HTTP options to send with the request.

可選. 預設值是 `undefined`.
返回值

此請求的響應物件的 Observable,其回應內文為所請求的型別。

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

構造一個 Observable,當它被訂閱時,會要求伺服器執行配置好的 HEAD 請求。HEAD 方法會返回該資源的元資料,而不會傳輸資源本身。參見它的各個獨立過載形式,以瞭解其返回型別。

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.

15 個過載形式...

顯示所有 隱藏所有 expand_more
Overload #1

構造一個 HEAD 請求,它將請求體解釋為 ArrayBuffer,並且返回 ArrayBuffer 格式的回應內文。

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

端點 URL。

The endpoint URL.

options object

與請求一起傳送的 HTTP 選項。

The HTTP options to send with the request.

返回值

響應物件的 Observable,其回應內文為 ArrayBuffer 型別。

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


Overload #2

構造一個 HEAD 請求,它將請求體解釋為 Blob,並且返回 Blob 格式的回應內文。

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

端點 URL。

The endpoint URL.

options object

與請求一起傳送的 HTTP 選項。

The HTTP options to send with the request.

返回值

響應物件的 Observable ,其回應內文為 Blob 型別。

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


Overload #3

構造一個 HEAD 請求,它將請求體解釋為字串,並且返回字串格式的響應。

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

端點 URL。

The endpoint URL.

options object

與請求一起傳送的 HTTP 選項。

The HTTP options to send with the request.

返回值

此請求的響應物件的 Observable,其回應內文為 string 型別。

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


Overload #4

構造一個 HEAD 請求,它把請求體解釋為 ArrayBuffer,並返回完整事件的流。

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

端點 URL。

The endpoint URL.

options object

與請求一起傳送的 HTTP 選項。

The HTTP options to send with the request.

返回值

此請求的 HttpEventsObservable,其回應內文為 ArrayBuffer 型別。

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


Overload #5

構造一個 HEAD 請求,它將請求體解釋為 Blob,並返回完整的事件流。

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

端點 URL。

The endpoint URL.

options object

與請求一起傳送的 HTTP 選項。

The HTTP options to send with the request.

返回值

此請求的 HttpEventsObservable,其回應內文為 Blob 型別。

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


Overload #6

構造一個 HEAD 請求,它將請求體解釋為文字字串,並且返回完整的事件流。

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

端點 URL。

The endpoint URL.

options object

與請求一起傳送的 HTTP 選項。

The HTTP options to send with the request.

返回值

表示啥此請求的 HttpEvents for the requestObservable,回應內文為 string 型別。

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


Overload #7

構造一個 HEAD 請求,它將請求體解釋為 JSON 物件,並且返回完整的 HTTP 事件流。

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

端點 URL。

The endpoint URL.

options object

與請求一起傳送的 HTTP 選項。

The HTTP options to send with the request.

返回值

表示啥此請求的 HTTPEventsObservable,回應內文為 Object 型別。

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


Overload #8

構造一個 HEAD 請求,它將請求體解釋為 JSON 物件,並且返回完整的 HTTP 事件流。

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

端點 URL。

The endpoint URL.

options object

與請求一起傳送的 HTTP 選項。

The HTTP options to send with the request.

返回值

表示此請求的 HTTPEventsObservable,回應內文為所請求的型別。

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


Overload #9

構造一個 HEAD 請求,它將請求體解釋為 ArrayBuffer,並且返回完整的 HttpResponse

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

端點 URL。

The endpoint URL.

options object

與請求一起傳送的 HTTP 選項。

The HTTP options to send with the request.

返回值

此請求的響應物件的 Observable,其回應內文為 ArrayBuffer 型別。

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


Overload #10

構造一個 HEAD 請求,它將請求體解釋為 Blob,並且返回完整的 HttpResponse

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

端點 URL。

The endpoint URL.

options object

與請求一起傳送的 HTTP 選項。

The HTTP options to send with the request.

返回值

此請求的響應物件的 Observable,其回應內文為 blob 型別。

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


Overload #11

構造一個 HEAD 請求,它將請求體解釋為文字流,並且返回完整的 HttpResponse

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

端點 URL。

The endpoint URL.

options object

與請求一起傳送的 HTTP 選項。

The HTTP options to send with the request.

返回值

此請求的響應物件的 Observable,其回應內文為 string 型別。

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


Overload #12

構造一個 HEAD 請求,它將請求體解釋為 JSON 物件,並且返回完整的 HttpResponse

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

端點 URL。

The endpoint URL.

options object

與請求一起傳送的 HTTP 選項。

The HTTP options to send with the request.

返回值

此請求的響應物件的 Observable,其回應內文為 Object 型別。

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


Overload #13

構造一個 HEAD 請求,它將請求體解釋為 JSON 物件,並且返回完整的 HttpResponse

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

端點 URL。

The endpoint URL.

options object

與請求一起傳送的 HTTP 選項。

The HTTP options to send with the request.

返回值

此請求的響應物件的 Observable,其回應內文為所請求的型別。

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


Overload #14

構造一個 HEAD 請求,它將請求體解釋為 JSON 物件,並且返回 JSON 物件格式的回應內文。

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

端點 URL。

The endpoint URL.

options object

與請求一起傳送的 HTTP 選項。

The HTTP options to send with the request.

可選. 預設值是 `undefined`.
返回值

響應物件的 Observable ,其回應內文為 JSON 物件。

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


Overload #15

構造一個 HEAD 請求,它將請求體解釋為 JSON 物件,並且返回給定型別的響應。

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

端點 URL。

The endpoint URL.

options object

與請求一起傳送的 HTTP 選項。

The HTTP options to send with the request.

可選. 預設值是 `undefined`.
返回值

此請求的響應物件的 Observable,其回應內文為給定的型別。

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

構造一個 Observable ,當訂閱該 Observable 時,將透過攔截器管道分派特殊的 JSONP 方法。JSONP 模式 可繞過某些 API 端點的侷限性,這些端點不支援新的方式。更推薦使用 CORS 協議。JSONP 將端點 API 視為 JavaScript 檔案,並欺騙瀏覽器處理請求,即使 API 端點與發出請求的客戶端應用不在同一個域(源)上。端點 API 必須支援 JSONP 回呼(Callback),JSONP 請求才能正常工作。此資源 API 會返回包裝在回呼(Callback)函式中的 JSON 響應。你可以將回調函式名稱作為查詢引數之一傳遞。請注意,JSONP 請求只能與 GET 請求一起使用。

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.

為給定的 URL 和回呼(Callback)引數的名稱構造一個 JSONP

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

資源 URL。

The resource URL.

callbackParam string

回呼(Callback)函式名稱。

The callback function name.

返回值

響應物件的 Observable ,其回應內文為物件型別。

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

為給定的 URL 和回呼(Callback)引數的名稱構造一個 JSONP

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

資源 URL。

The resource URL.

callbackParam string

回呼(Callback)函式名稱。

The callback function name.

你必須安裝合適的攔截器,例如 HttpClientJsonpModule 提供的攔截器。如果未經過此類別攔截器,則所配置的後端可以拒絕 JSONP

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 ,其回應內文為所請求的型別。

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

構造一個 Observable,當訂閱該 Observable 時,它會讓已配置的 OPTIONS 請求在伺服器上執行。此方法允許客戶端確定所支援的 HTTP 方法和端點的其他功能,而無需進行隱式資源操作。有關返回型別的詳細資訊,請參見各個過載。

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.

15 個過載形式...

顯示所有 隱藏所有 expand_more
Overload #1

構造一個 OPTIONS 請求,它將請求體解釋為 ArrayBuffer,並且返回 ArrayBuffer 格式的回應內文。

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

端點 URL。

The endpoint URL.

options object

HTTP 選項。

HTTP options.

返回值

響應物件的 Observable,其回應內文為 ArrayBuffer 型別。

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


Overload #2

構造一個 OPTIONS 請求,它將請求體解釋為 Blob,並且返回 Blob 格式的回應內文。

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

端點 URL。

The endpoint URL.

options object

HTTP 選項。

HTTP options.

返回值

響應物件的 Observable ,其回應內文為 Blob 型別。

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


Overload #3

構造一個 OPTIONS 請求,它將請求體解釋為字串,並且返回一個字串。

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

端點 URL。

The endpoint URL.

options object

HTTP 選項。

HTTP options.

返回值

此請求的響應物件的 Observable,其回應內文為 string 型別。

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


Overload #4

構造一個 OPTIONS 請求,它將請求體解釋為 ArrayBuffer,並返回完整的事件流。

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

端點 URL。

The endpoint URL.

options object

HTTP 選項。

HTTP options.

返回值

此請求的 HttpEventsObservable,其回應內文為 ArrayBuffer 型別。

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


Overload #5

構造一個 OPTIONS 請求,它將請求體解釋為 Blob,並返回完整的事件流。

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

端點 URL。

The endpoint URL.

options object

HTTP 選項。

HTTP options.

返回值

此請求的 HttpEventsObservable,其回應內文為 Blob 型別。

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


Overload #6

構造一個 OPTIONS 請求,它將請求體解釋為文字字串,並且返回完整的事件流。

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

端點 URL。

The endpoint URL.

options object

HTTP 選項。

HTTP options.

返回值

此請求的 HTTPEventsObservable,其回應內文為 string 型別。

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


Overload #7

構造一個 OPTIONS 請求,它將請求體解釋為 JSON 物件,並且返回完整的 HTTP 事件流。

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

端點 URL。

The endpoint URL.

options object

HTTP 選項。

HTTP options.

返回值

表示啥此請求的 HttpEventsObservable,回應內文為 Object 型別。

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


Overload #8

構造一個 OPTIONS 請求,它將請求體解釋為 JSON 物件,並且返回完整的 HTTP 事件流。

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

端點 URL。

The endpoint URL.

options object

HTTP 選項。

HTTP options.

返回值

此請求的 HttpEventsObservable,其回應內文為所請求的型別。

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


Overload #9

構造一個 OPTIONS 請求,它將請求體解釋為 ArrayBuffer,並且返回完整的 HttpResponse

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

端點 URL。

The endpoint URL.

options object

HTTP 選項。

HTTP options.

返回值

此請求的響應物件的 Observable,其回應內文為 ArrayBuffer 型別。

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


Overload #10

構造一個 OPTIONS 請求,它將請求體解釋為 Blob,並且返回完整的 HttpResponse

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

端點 URL。

The endpoint URL.

options object

HTTP 選項。

HTTP options.

返回值

此請求的響應物件的 Observable,其回應內文為 Blob 型別。

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


Overload #11

構造一個 OPTIONS 請求,它將請求體解釋為文字流,並且返回完整的 HttpResponse

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

端點 URL。

The endpoint URL.

options object

HTTP 選項。

HTTP options.

返回值

此請求的響應物件的 Observable,其回應內文為 string 型別。

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


Overload #12

構造一個 OPTIONS 請求,它將請求體解釋為 JSON 物件,並且返回完整的 HttpResponse

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

端點 URL。

The endpoint URL.

options object

HTTP 選項。

HTTP options.

返回值

此請求的響應物件的 Observable,其回應內文為 Object 型別。

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


Overload #13

構造一個 OPTIONS 請求,它將請求體解釋為 JSON 物件,並且返回完整的 HttpResponse

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

端點 URL。

The endpoint URL.

options object

HTTP 選項。

HTTP options.

返回值

此請求的響應物件的 Observable,其回應內文為所請求的型別。

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


Overload #14

構造一個 OPTIONS 請求,它將請求體解釋為 JSON 物件,並且返回 JSON 物件格式的回應內文。

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

端點 URL。

The endpoint URL.

options object

HTTP 選項。

HTTP options.

可選. 預設值是 `undefined`.
返回值

響應物件的 Observable ,其回應內文為 JSON 物件。

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


Overload #15

構造一個 OPTIONS 請求,它將請求體解釋為 JSON 物件,並且返回給定型別的響應。

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

端點 URL。

The endpoint URL.

options object

HTTP 選項。

HTTP options.

可選. 預設值是 `undefined`.
返回值

此請求的響應物件的 Observable,其回應內文為給定的型別。

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

構造一個 Observable,當它被訂閱時,會要求伺服器執行配置好的 PATCH 請求。參見它的各個獨立過載形式,以瞭解其返回值型別。

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.

15 個過載形式...

顯示所有 隱藏所有 expand_more
Overload #1

構造一個 PATCH 請求,它將請求體解釋為 ArrayBuffer,並且返回 ArrayBuffer 格式的回應內文。

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

端點 URL。

The endpoint URL.

body any

要編輯的資源。

The resources to edit.

options object

HTTP 選項。

HTTP options.

返回值

響應物件的 Observable,其回應內文為 ArrayBuffer 型別。

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


Overload #2

構造一個 PATCH 請求,它將請求體解釋為 Blob,並且返回 Blob 格式的回應內文。

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

端點 URL。

The endpoint URL.

body any

要編輯的資源。

The resources to edit.

options object

HTTP 選項。

HTTP options.

返回值

響應物件的 Observable ,其回應內文為 Blob 型別。

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


Overload #3

構造一個 PATCH 請求,它將請求體解釋為字串,並且返回字串格式的響應。

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

端點 URL。

The endpoint URL.

body any

要編輯的資源。

The resources to edit.

options object

HTTP 選項。

HTTP options.

返回值

此請求的響應物件的 Observable,其回應內文為 string 型別。

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


Overload #4

構造一個 PATCH 請求,它將請求體解釋為 ArrayBuffer,並返回完整的事件流。

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

端點 URL。

The endpoint URL.

body any

要編輯的資源。

The resources to edit.

options object

HTTP 選項。

HTTP options.

返回值

此請求的 HTTPeventsObservable,其回應內文為 ArrayBuffer 型別。

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


Overload #5

構造一個 PATCH 請求,它將請求體解釋為 Blob,並返回完整的事件流。

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

端點 URL。

The endpoint URL.

body any

要編輯的資源。

The resources to edit.

options object

HTTP 選項。

HTTP options.

返回值

表示此請求的 HTTPeventsObservable,回應內文為 Blob 型別。

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


Overload #6

構造一個 PATCH 請求,它將請求體解釋為文字字串,並且返回完整的事件流。

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

端點 URL。

The endpoint URL.

body any

要編輯的資源。

The resources to edit.

options object

HTTP 選項。

HTTP options.

返回值

表示啥此請求的 HTTPeventsObservable,回應內文為 string 型別。

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


Overload #7

構造一個 PATCH 請求,它將請求體解釋為 JSON 物件,並且返回完整的 HTTP 事件流。

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

端點 URL。

The endpoint URL.

body any

要編輯的資源。

The resources to edit.

options object

HTTP 選項。

HTTP options.

返回值

此請求的 HTTPeventsObservable,其回應內文為 Object 型別。

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


Overload #8

構造一個 PATCH 請求,它將請求體解釋為 JSON 物件,並且返回完整的 HTTP 事件流。

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

端點 URL。

The endpoint URL.

body any

要編輯的資源。

The resources to edit.

options object

HTTP 選項。

HTTP options.

返回值

此請求的 HTTPeventsObservable,其回應內文為所請求的型別。

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


Overload #9

構造一個 PATCH 請求,它將請求體解釋為 ArrayBuffer,並且返回完整的 HttpResponse

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

端點 URL。

The endpoint URL.

body any

要編輯的資源。

The resources to edit.

options object

HTTP 選項。

HTTP options.

返回值

此請求的響應物件的 Observable,其回應內文為 ArrayBuffer 型別。

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


Overload #10

構造一個 PATCH 請求,它將請求體解釋為 Blob,並且返回完整的 HttpResponse

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

端點 URL。

The endpoint URL.

body any

要編輯的資源。

The resources to edit.

options object

HTTP 選項。

HTTP options.

返回值

此請求的響應物件的 Observable,其回應內文為 Blob 型別。

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


Overload #11

構造一個 PATCH 請求,它將請求體解釋為文字流,並且返回完整的 HttpResponse

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

端點 URL。

The endpoint URL.

body any

要編輯的資源。

The resources to edit.

options object

HTTP 選項。

HTTP options.

返回值

此請求的響應物件的 Observable,其回應內文為 string 型別。

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


Overload #12

構造一個 PATCH 請求,它將請求體解釋為 JSON 物件,並且返回完整的 HttpResponse

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

端點 URL。

The endpoint URL.

body any

要編輯的資源。

The resources to edit.

options object

HTTP 選項。

HTTP options.

返回值

此請求的響應物件的 Observable,其回應內文為所請求的型別。

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


Overload #13

構造一個 PATCH 請求,它將請求體解釋為 JSON 物件,並且返回完整的 HttpResponse

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

端點 URL。

The endpoint URL.

body any

要編輯的資源。

The resources to edit.

options object

HTTP 選項。

HTTP options.

返回值

此請求的響應物件的 Observable,其回應內文為給定的型別。

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


Overload #14

構造一個 PATCH 請求,它將請求體解釋為 JSON 物件,並且返回 JSON 物件格式的回應內文。

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

端點 URL。

The endpoint URL.

body any

要編輯的資源。

The resources to edit.

options object

HTTP 選項。

HTTP options.

可選. 預設值是 `undefined`.
返回值

響應物件的 Observable ,其回應內文為 JSON 物件。

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


Overload #15

構造一個 PATCH 請求,它將請求體解釋為 JSON 物件,並且返回給定型別的響應。

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

端點 URL。

The endpoint URL.

body any

要編輯的資源。

The resources to edit.

options object

HTTP 選項。

HTTP options.

可選. 預設值是 `undefined`.
返回值

此請求的響應物件的 Observable,其回應內文為給定的型別。

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

構造一個 Observable,當訂閱該 Observable 時,它會讓已配置的 POST 請求在伺服器上執行。。伺服器以替換後資源的位置進行響應。有關返回型別的詳細資訊,請參見各個過載。

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.

15 個過載形式...

顯示所有 隱藏所有 expand_more
Overload #1

構造一個 POST 請求,它將請求體解釋為 ArrayBuffer,並且返回 ArrayBuffer

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

端點 URL。

The endpoint URL.

body any

要替換的內容。

The content to replace with.

options object

HTTP 選項。

HTTP options.

返回值

響應物件的 Observable,其回應內文為 ArrayBuffer 型別。

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


Overload #2

構造一個 POST 請求,它將請求體解釋為 Blob,並且返回 Blob 格式的回應內文。

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

端點 URL。

The endpoint URL.

body any

要替換的內容。

The content to replace with.

options object

HTTP 選項

HTTP options

返回值

響應物件的 Observable ,其回應內文為 Blob 型別。

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


Overload #3

構造一個 POST 請求,它將請求體解釋為字串,並且返回字串格式的響應。

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

端點 URL。

The endpoint URL.

body any

要替換的內容。

The content to replace with.

options object

HTTP 選項

HTTP options

返回值

此請求的響應物件的 Observable,其回應內文為 string 型別。

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


Overload #4

構造一個 POST 請求,它將請求體解釋為 ArrayBuffer,並返回完整的事件流。

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

端點 URL。

The endpoint URL.

body any

要替換的內容。

The content to replace with.

options object

HTTP 選項

HTTP options

返回值

此請求的 HttpEventsObservable,其回應內文為 ArrayBuffer 型別。

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


Overload #5

構造一個 POST 請求,它把請求體解釋為 Blob,並返回完整事件流的 Observable

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

端點 URL。

The endpoint URL.

body any

要替換的內容。

The content to replace with.

options object

HTTP 選項

HTTP options

返回值

此請求的 HttpEventsObservable,其回應內文為 Blob 型別。

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


Overload #6

構造一個 POST 請求,它將請求體解釋為文字字串,並且返回完整的事件流。

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

端點 URL。

The endpoint URL.

body any

要替換的內容。

The content to replace with.

options object

HTTP 選項

HTTP options

返回值

此請求的 HttpEventsObservable,其回應內文為 string 型別。

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


Overload #7

構造一個 POST 請求,它將請求體解釋為 JSON 物件,並且返回完整的 HTTP 事件流。

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

端點 URL。

The endpoint URL.

body any

要替換的內容。

The content to replace with.

options object

HTTP 選項

HTTP options

返回值

此請求的 HttpEventsObservable,其回應內文為 Object 型別。

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


Overload #8

構造一個 POST 請求,它將請求體解釋為 JSON 物件,並且返回完整的 HTTP 事件流。

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

端點 URL。

The endpoint URL.

body any

要替換的內容。

The content to replace with.

options object

HTTP 選項

HTTP options

返回值

此請求的 HttpEventsObservable,其回應內文為所請求的型別。

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


Overload #9

構造一個 POST 請求,它將請求體解釋為 ArrayBuffer 型別,並返回完整的 HTTPresponse

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

端點 URL。

The endpoint URL.

body any

要替換的內容。

The content to replace with.

options object

HTTP 選項

HTTP options

返回值

此請求的響應物件的 Observable,其回應內文為 ArrayBuffer 型別。

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


Overload #10

構造一個 POST 請求,它將請求體解釋為 Blob,並且返回完整的 HttpResponse

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

端點 URL。

The endpoint URL.

body any

要替換的內容。

The content to replace with.

options object

HTTP 選項

HTTP options

返回值

此請求的響應物件的 Observable,其回應內文為 Blob 型別。

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


Overload #11

構造一個 POST 請求,它將請求體解釋為文字流,並且返回完整的 HttpResponse

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

端點 URL。

The endpoint URL.

body any

要替換的內容。

The content to replace with.

options object

HTTP 選項

HTTP options

返回值

此請求的響應物件的 Observable,其回應內文為 string 型別。

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


Overload #12

構造一個 POST 請求,它將請求體解釋為 JSON 物件,並且返回完整的 HttpResponse

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

端點 URL。

The endpoint URL.

body any

要替換的內容。

The content to replace with.

options object

HTTP 選項

HTTP options

返回值

表示啥此請求的 HTTPResponseObservable,回應內文為 Object 型別。

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


Overload #13

構造一個 POST 請求,它將請求體解釋為 JSON 物件,並且返回完整的 HttpResponse

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

端點 URL。

The endpoint URL.

body any

要替換的內容。

The content to replace with.

options object

HTTP 選項

HTTP options

返回值

表示此請求的 HTTPResponseObservable,回應內文為所請求的型別。

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


Overload #14

構造一個 POST 請求,它將請求體解釋為 JSON 物件,並且返回 JSON 物件格式的回應內文。

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

端點 URL。

The endpoint URL.

body any

要替換的內容。

The content to replace with.

options object

HTTP 選項

HTTP options

可選. 預設值是 `undefined`.
返回值

響應物件的 Observable ,其回應內文為 JSON 物件。

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


Overload #15

構造一個 POST 請求,它將請求體解釋為 JSON 物件,並且返回響應物件的 Observable

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

端點 URL。

The endpoint URL.

body any

要替換的內容。

The content to replace with.

options object

HTTP 選項

HTTP options

可選. 預設值是 `undefined`.
返回值

表示此請求的 HTTPResponseObservable,回應內文為所請求的型別。

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

構造一個 Observable,當訂閱該 Observable 時,它會讓已配置的 PUT 請求在伺服器上執行。。 PUT 方法用一組新值替換現有資源。有關返回型別的詳細資訊,請參見各個過載。

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.

15 個過載形式...

顯示所有 隱藏所有 expand_more
Overload #1

構造一個 PUT 請求,它將請求體解釋為 ArrayBuffer,並且返回 ArrayBuffer 格式的回應內文。

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

端點 URL。

The endpoint URL.

body any

要新增/更新的資源。

The resources to add/update.

options object

HTTP 選項

HTTP options

返回值

響應物件的 Observable,其回應內文為 ArrayBuffer 型別。

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


Overload #2

構造一個 PUT 請求,它將請求體解釋為 Blob,並且返回 Blob 格式的回應內文。

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

端點 URL。

The endpoint URL.

body any

要新增/更新的資源。

The resources to add/update.

options object

HTTP 選項

HTTP options

返回值

響應物件的 Observable ,其回應內文為 Blob 型別。

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


Overload #3

構造一個 PUT 請求,它將請求體解釋為字串,並且返回字串格式的響應。

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

端點 URL。

The endpoint URL.

body any

要新增/更新的資源。

The resources to add/update.

options object

HTTP 選項

HTTP options

返回值

此請求的響應物件的 Observable,其回應內文為 string 型別。

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


Overload #4

構造一個 PUT 請求,它將請求體解釋為 ArrayBuffer,並返回完整的事件流。

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

端點 URL。

The endpoint URL.

body any

要新增/更新的資源。

The resources to add/update.

options object

HTTP 選項

HTTP options

返回值

此請求的 HttpEventsObservable,其回應內文為 ArrayBuffer 型別。

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


Overload #5

構造一個 PUT 請求,它將請求體解釋為 Blob,並返回完整的事件流。

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

端點 URL。

The endpoint URL.

body any

要新增/更新的資源。

The resources to add/update.

options object

HTTP 選項

HTTP options

返回值

此請求的 HttpEventsObservable,其回應內文為 Blob 型別。

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


Overload #6

構造一個 PUT 請求,它將請求體解釋為文字字串,並且返回完整的事件流。

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

端點 URL。

The endpoint URL.

body any

要新增/更新的資源。

The resources to add/update.

options object

HTTP 選項

HTTP options

返回值

表示啥此請求的 HttpEvents for the requestObservable,回應內文為 string 型別。

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


Overload #7

構造一個 PUT 請求,它將請求體解釋為 JSON 物件,並且返回完整的 HTTP 事件流。

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

端點 URL。

The endpoint URL.

body any

要新增/更新的資源。

The resources to add/update.

options object

HTTP 選項

HTTP options

返回值

此請求的 HttpEventsObservable,其回應內文為 Object 型別。

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


Overload #8

構造一個 PUT 請求,它將請求體解釋為 JSON 物件,並且返回完整的 HTTP 事件流。

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"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType?: "json"; withCredentials?: boolean; }): Observable<HttpEvent<T>>
      
      put<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

端點 URL。

The endpoint URL.

body any

要新增/更新的資源。

The resources to add/update.

options object

HTTP 選項

HTTP options

返回值

此請求的 HttpEventsObservable,其回應內文為所請求的型別。

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


Overload #9

構造一個 PUT 請求,它將請求體解釋為 ArrayBuffer,並返回完整的 HttpResponse

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

端點 URL。

The endpoint URL.

body any

要新增/更新的資源。

The resources to add/update.

options object

HTTP 選項

HTTP options

返回值

此請求的響應物件的 Observable,其回應內文為 ArrayBuffer 型別。

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


Overload #10

構造一個 PUT 請求,它將請求體解釋為 Blob,並且返回完整的 HttpResponse

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

端點 URL。

The endpoint URL.

body any

要新增/更新的資源。

The resources to add/update.

options object

HTTP 選項

HTTP options

返回值

此請求的響應物件的 Observable,其回應內文為 Blob 型別。

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


Overload #11

構造一個 PUT 請求,它將請求體解釋為文字流,並返回完整的 HttpResponse

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

端點 URL。

The endpoint URL.

body any

要新增/更新的資源。

The resources to add/update.

options object

HTTP 選項

HTTP options

返回值

表示啥此請求的 HTTPResponseObservable,回應內文為 string 型別。

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


Overload #12

構造一個 PUT 請求,它將請求體解釋為 JSON 物件,並返回完整的 HttpResponse

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

端點 URL。

The endpoint URL.

body any

要新增/更新的資源。

The resources to add/update.

options object

HTTP 選項

HTTP options

返回值

此請求的響應物件的 Observable,其回應內文為 Object 型別。

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


Overload #13

構造一個 PUT 請求,它將請求體解釋為所請求型別的實例,並返回完整的 HTTP 響應物件。

Constructs a PUT request that interprets the body as an instance of the requested type 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

端點 URL。

The endpoint URL.

body any

要新增/更新的資源。

The resources to add/update.

options object

HTTP 選項

HTTP options

返回值

此請求的響應物件的 Observable,其回應內文為所請求的型別。

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


Overload #14

構造一個 PUT 請求,它將請求體解釋為 JSON 物件,並返回 JSON 物件的 Observable

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

端點 URL。

The endpoint URL.

body any

要新增/更新的資源。

The resources to add/update.

options object

HTTP 選項

HTTP options

可選. 預設值是 `undefined`.
返回值

JSON 格式的響應物件的 Observable

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


Overload #15

構造一個 PUT 請求,它將請求體解釋為所請求型別的實例,並返回所請求型別的響應流。

Constructs a PUT request that interprets the body as an instance of the requested type and returns an observable of the requested type.

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

端點 URL。

The endpoint URL.

body any

要新增/更新的資源。

The resources to add/update.

options object

HTTP 選項

HTTP options

可選. 預設值是 `undefined`.
返回值

所請求型別的 Observable

Observable<T>: An Observable of the requested type.

使用說明

“英雄之旅”應用程式的示例 HTTP 請求。

Sample HTTP requests for the Tour of Heroes application.

HTTP 請求示例

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 示例

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 示例

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')));
}