填写这份《一分钟调查》,帮我们(开发组)做得更好!去填写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[]; }; context?: HttpContext; observe?: "body" | "events" | "response"; params?: HttpParams | { [param: string]: string | number | boolean | ReadonlyArray<...>; }; reportProgress?: boolean; responseType?: "arraybuffer" | ... 2 more ... | "json"... = {}): Observable<any>
  delete(url: string, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; context?: HttpContext; observe?: "body" | "events" | "response"; params?: HttpParams | { [param: string]: string | number | boolean | ReadonlyArray<string | ... 1 more ... | boolean>; }; reportProgress?: boolean; responseType?: "arraybuffer" | ... 2... = {}): Observable<any>
  get(url: string, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; context?: HttpContext; observe?: "body" | "events" | "response"; params?: HttpParams | { [param: string]: string | number | boolean | ReadonlyArray<string | ... 1 more ... | boolean>; }; reportProgress?: boolean; responseType?: "arraybuffer" | ... 2... = {}): Observable<any>
  head(url: string, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; context?: HttpContext; observe?: "body" | "events" | "response"; params?: HttpParams | { [param: string]: string | number | boolean | ReadonlyArray<string | ... 1 more ... | boolean>; }; reportProgress?: boolean; responseType?: "arraybuffer" | ... 2... = {}): Observable<any>
  jsonp<T>(url: string, callbackParam: string): Observable<T>
  options(url: string, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; context?: HttpContext; observe?: "body" | "events" | "response"; params?: HttpParams | { [param: string]: string | number | boolean | ReadonlyArray<string | ... 1 more ... | boolean>; }; reportProgress?: boolean; responseType?: "arraybuffer" | ... 2... = {}): Observable<any>
  patch(url: string, body: any, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; context?: HttpContext; observe?: "body" | "events" | "response"; params?: HttpParams | { [param: string]: string | number | boolean | ReadonlyArray<string | ... 1 more ... | boolean>; }; reportProgress?: boolean; responseType?: "arraybuffer" | ... 2... = {}): Observable<any>
  post(url: string, body: any, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; context?: HttpContext; observe?: "body" | "events" | "response"; params?: HttpParams | { [param: string]: string | number | boolean | ReadonlyArray<string | ... 1 more ... | boolean>; }; reportProgress?: boolean; responseType?: "arraybuffer" | ... 2... = {}): Observable<any>
  put(url: string, body: any, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; context?: HttpContext; observe?: "body" | "events" | "response"; params?: HttpParams | { [param: string]: string | number | boolean | ReadonlyArray<string | ... 1 more ... | boolean>; }; reportProgress?: boolean; responseType?: "arraybuffer" | ... 2... = {}): Observable<any>
}
    

参见

Provided in

说明

请注意, 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.

Further information available in the Usage Notes...

方法

为任意 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>>
    
参数
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[]; }; context?: HttpContext; observe?: "body"; params?: HttpParams | { [param: string]: string | number | boolean | ReadonlyArray<string | number | boolean>; }; 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[]; }; context?: HttpContext; observe?: "body"; params?: HttpParams | { [param: string]: string | number | boolean | ReadonlyArray<string | number | boolean>; }; 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[]; }; context?: HttpContext; observe?: "body"; params?: HttpParams | { [param: string]: string | number | boolean | ReadonlyArray<string | number | boolean>; }; 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[]; }; context?: HttpContext; params?: HttpParams | { [param: string]: string | number | boolean | ReadonlyArray<string | number | boolean>; }; 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,其响应主体为此请求的 HttpEvent

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"; context?: HttpContext; params?: HttpParams | { [param: string]: string | number | boolean | ReadonlyArray<string | number | boolean>; }; 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 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"; context?: HttpContext; params?: HttpParams | { [param: string]: string | number | boolean | ReadonlyArray<string | number | boolean>; }; 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 request, 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[]; }; context?: HttpContext; reportProgress?: boolean; observe: "events"; params?: HttpParams | { [param: string]: string | number | boolean | ReadonlyArray<...>; }; 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[]; }; context?: HttpContext; reportProgress?: boolean; observe: "events"; params?: HttpParams | { [param: string]: string | number | boolean | ReadonlyArray<...>; }; 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"; context?: HttpContext; params?: HttpParams | { [param: string]: string | number | boolean | ReadonlyArray<string | number | boolean>; }; reportProgress?: boolean; responseType: "arraybuffer"; withCredentials?: boolea...): Observable<HttpResponse<ArrayBuffer>>
    
参数
method string

HTTP 方法。

The HTTP method.

url string

端点 URL。

The endpoint URL.

options { body?: any; headers?: HttpHeaders | { [header: string]: string | string[]; }; observe: "response"; context?: HttpContext; params?: HttpParams | { [param: string]: string | number | boolean | ReadonlyArray; }; reportProgress?: boolean; responseType: "arraybuffer"; withCredentials?: boolea...

与请求一起发送的 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"; context?: HttpContext; params?: HttpParams | { [param: string]: string | number | boolean | ReadonlyArray<string | number | boolean>; }; 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"; context?: HttpContext; params?: HttpParams | { [param: string]: string | number | boolean | ReadonlyArray<string | number | boolean>; }; 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[]; }; context?: HttpContext; reportProgress?: boolean; observe: "response"; params?: HttpParams | { [param: string]: string | number | boolean | ReadonlyArray<...>; }; 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[]; }; context?: HttpContext; reportProgress?: boolean; observe: "response"; params?: HttpParams | { [param: string]: string | number | boolean | ReadonlyArray<...>; }; 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[]; }; context?: HttpContext; observe?: "body"; params?: HttpParams | { [param: string]: string | number | boolean | ReadonlyArray<string | number | boolean>; }; 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[]; }; context?: HttpContext; observe?: "body"; params?: HttpParams | { [param: string]: string | number | boolean | ReadonlyArray<string | number | boolean>; }; 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[]; }; context?: HttpContext; params?: HttpParams | { [param: string]: string | number | boolean | ReadonlyArray<string | number | boolean>; }; observe?: "body" | ... 1 more ... | "response"; reportProgress?: boolean; responseType?: "arraybuffe...): Observable<any>
    
参数
method string

HTTP 方法。

The HTTP method.

url string

端点 URL。

The endpoint URL.

options { body?: any; headers?: HttpHeaders | { [header: string]: string | string[]; }; context?: HttpContext; params?: HttpParams | { [param: string]: string | number | boolean | ReadonlyArray; }; observe?: "body" | ... 1 more ... | "response"; reportProgress?: boolean; responseType?: "arraybuffe...

与请求一起发送的 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[]; }; context?: HttpContext; observe?: "body"; params?: HttpParams | { [param: string]: string | number | boolean | ReadonlyArray<string | number | boolean>; }; reportProgress?: boolean; responseType: "arraybuffer"; withCredentials?: boolean; body?: any; }): 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[]; }; context?: HttpContext; observe?: "body"; params?: HttpParams | { [param: string]: string | number | boolean | ReadonlyArray<string | number | boolean>; }; reportProgress?: boolean; responseType: "blob"; withCredentials?: boolean; body?: any; }): 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[]; }; context?: HttpContext; observe?: "body"; params?: HttpParams | { [param: string]: string | number | boolean | ReadonlyArray<string | number | boolean>; }; reportProgress?: boolean; responseType: "text"; withCredentials?: boolean; body?: any; }): 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"; context?: HttpContext; params?: HttpParams | { [param: string]: string | number | boolean | ReadonlyArray<string | number | boolean>; }; reportProgress?: boolean; responseType: "arraybuffer"; withCredentials?: boolean; body?: any; }): 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"; context?: HttpContext; params?: HttpParams | { [param: string]: string | number | boolean | ReadonlyArray<string | number | boolean>; }; reportProgress?: boolean; responseType: "blob"; withCredentials?: boolean; body?: any; }): 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"; context?: HttpContext; params?: HttpParams | { [param: string]: string | number | boolean | ReadonlyArray<string | number | boolean>; }; reportProgress?: boolean; responseType: "text"; withCredentials?: boolean; body?: any; }): 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"; context?: HttpContext; params?: HttpParams | { [param: string]: string | number | boolean | ReadonlyArray<string | number | boolean>; }; reportProgress?: boolean; responseType?: "json"; withCredentials?: boolean; body?: any; }): 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"; context?: HttpContext; params?: HttpParams | { [param: string]: string | number | boolean | (string | number | boolean)[]; }; reportProgress?: boolean; responseType?: "json"; withCredentials?: boolean; body?: any; }): 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"; context?: HttpContext; params?: HttpParams | { [param: string]: string | number | boolean | ReadonlyArray<string | number | boolean>; }; reportProgress?: boolean; responseType: "arraybuffer"; withCredentials?: boolean; body?: an...): Observable<HttpResponse<ArrayBuffer>>
    
参数
url string

端点 URL。

The endpoint URL.

options { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe: "response"; context?: HttpContext; params?: HttpParams | { [param: string]: string | number | boolean | ReadonlyArray; }; reportProgress?: boolean; responseType: "arraybuffer"; withCredentials?: boolean; body?: an...

与请求一起发送的 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"; context?: HttpContext; params?: HttpParams | { [param: string]: string | number | boolean | ReadonlyArray<string | number | boolean>; }; reportProgress?: boolean; responseType: "blob"; withCredentials?: boolean; body?: any; }): 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"; context?: HttpContext; params?: HttpParams | { [param: string]: string | number | boolean | ReadonlyArray<string | number | boolean>; }; reportProgress?: boolean; responseType: "text"; withCredentials?: boolean; body?: any; }): 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"; context?: HttpContext; params?: HttpParams | { [param: string]: string | number | boolean | ReadonlyArray<string | number | boolean>; }; reportProgress?: boolean; responseType?: "json"; withCredentials?: boolean; body?: any; }): 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"; context?: HttpContext; params?: HttpParams | { [param: string]: string | number | boolean | ReadonlyArray<string | number | boolean>; }; reportProgress?: boolean; responseType?: "json"; withCredentials?: boolean; body?: any; }): 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[]; }; context?: HttpContext; observe?: "body"; params?: HttpParams | { [param: string]: string | number | boolean | ReadonlyArray<string | number | boolean>; }; reportProgress?: boolean; responseType?: "json"; withCredentials?: boolean; body?: any; }): 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[]; }; context?: HttpContext; observe?: "body"; params?: HttpParams | { [param: string]: string | number | boolean | ReadonlyArray<string | number | boolean>; }; reportProgress?: boolean; responseType?: "json"; withCredentials?: boolean; body?: any; }): 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[]; }; context?: HttpContext; observe?: "body"; params?: HttpParams | { [param: string]: string | number | boolean | ReadonlyArray<string | number | boolean>; }; 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[]; }; context?: HttpContext; observe?: "body"; params?: HttpParams | { [param: string]: string | number | boolean | ReadonlyArray<string | number | boolean>; }; 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[]; }; context?: HttpContext; observe?: "body"; params?: HttpParams | { [param: string]: string | number | boolean | ReadonlyArray<string | number | boolean>; }; 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"; context?: HttpContext; params?: HttpParams | { [param: string]: string | number | boolean | ReadonlyArray<string | number | boolean>; }; 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"; context?: HttpContext; params?: HttpParams | { [param: string]: string | number | boolean | ReadonlyArray<string | number | boolean>; }; 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"; context?: HttpContext; params?: HttpParams | { [param: string]: string | number | boolean | ReadonlyArray<string | number | boolean>; }; 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"; context?: HttpContext; params?: HttpParams | { [param: string]: string | number | boolean | ReadonlyArray<string | number | boolean>; }; 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"; context?: HttpContext; params?: HttpParams | { [param: string]: string | number | boolean | ReadonlyArray<string | number | boolean>; }; 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"; context?: HttpContext; params?: HttpParams | { [param: string]: string | number | boolean | ReadonlyArray<string | number | boolean>; }; 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"; context?: HttpContext; params?: HttpParams | { [param: string]: string | number | boolean | ReadonlyArray<string | number | boolean>; }; 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"; context?: HttpContext; params?: HttpParams | { [param: string]: string | number | boolean | ReadonlyArray<string | number | boolean>; }; 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"; context?: HttpContext; params?: HttpParams | { [param: string]: string | number | boolean | ReadonlyArray<string | number | boolean>; }; 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"; context?: HttpContext; params?: HttpParams | { [param: string]: string | number | boolean | ReadonlyArray<string | number | boolean>; }; 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[]; }; context?: HttpContext; observe?: "body"; params?: HttpParams | { [param: string]: string | number | boolean | ReadonlyArray<string | number | boolean>; }; 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[]; }; context?: HttpContext; observe?: "body"; params?: HttpParams | { [param: string]: string | number | boolean | ReadonlyArray<string | number | boolean>; }; 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[]; }; context?: HttpContext; observe?: "body"; params?: HttpParams | { [param: string]: string | number | boolean | ReadonlyArray<string | number | boolean>; }; 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[]; }; context?: HttpContext; observe?: "body"; params?: HttpParams | { [param: string]: string | number | boolean | ReadonlyArray<string | number | boolean>; }; 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[]; }; context?: HttpContext; observe?: "body"; params?: HttpParams | { [param: string]: string | number | boolean | ReadonlyArray<string | number | boolean>; }; 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"; context?: HttpContext; params?: HttpParams | { [param: string]: string | number | boolean | ReadonlyArray<string | number | boolean>; }; 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 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"; context?: HttpContext; params?: HttpParams | { [param: string]: string | number | boolean | ReadonlyArray<string | number | boolean>; }; 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"; context?: HttpContext; params?: HttpParams | { [param: string]: string | number | boolean | ReadonlyArray<string | number | boolean>; }; 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"; context?: HttpContext; params?: HttpParams | { [param: string]: string | number | boolean | ReadonlyArray<string | number | boolean>; }; 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"; context?: HttpContext; params?: HttpParams | { [param: string]: string | number | boolean | ReadonlyArray<string | number | boolean>; }; 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"; context?: HttpContext; params?: HttpParams | { [param: string]: string | number | boolean | ReadonlyArray<string | number | boolean>; }; 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"; context?: HttpContext; params?: HttpParams | { [param: string]: string | number | boolean | ReadonlyArray<string | number | boolean>; }; 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"; context?: HttpContext; params?: HttpParams | { [param: string]: string | number | boolean | ReadonlyArray<string | number | boolean>; }; 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"; context?: HttpContext; params?: HttpParams | { [param: string]: string | number | boolean | ReadonlyArray<string | number | boolean>; }; 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"; context?: HttpContext; params?: HttpParams | { [param: string]: string | number | boolean | ReadonlyArray<string | number | boolean>; }; 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[]; }; context?: HttpContext; observe?: "body"; params?: HttpParams | { [param: string]: string | number | boolean | ReadonlyArray<string | number | boolean>; }; 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[]; }; context?: HttpContext; observe?: "body"; params?: HttpParams | { [param: string]: string | number | boolean | ReadonlyArray<string | number | boolean>; }; 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 回调,JSONP 请求才能正常工作。此资源 API 会返回包装在回调函数中的 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 和回调参数的名称构造一个 JSONP

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

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

资源 URL。

The resource URL.

callbackParam string

回调函数名称。

The callback function name.

返回值

响应对象的 Observable ,其响应体为对象类型。

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

为给定的 URL 和回调参数的名称构造一个 JSONP

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

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

资源 URL。

The resource URL.

callbackParam string

回调函数名称。

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[]; }; context?: HttpContext; observe?: "body"; params?: HttpParams | { [param: string]: string | number | boolean | ReadonlyArray<string | number | boolean>; }; 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[]; }; context?: HttpContext; observe?: "body"; params?: HttpParams | { [param: string]: string | number | boolean | ReadonlyArray<string | number | boolean>; }; 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[]; }; context?: HttpContext; observe?: "body"; params?: HttpParams | { [param: string]: string | number | boolean | ReadonlyArray<string | number | boolean>; }; 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"; context?: HttpContext; params?: HttpParams | { [param: string]: string | number | boolean | ReadonlyArray<string | number | boolean>; }; 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"; context?: HttpContext; params?: HttpParams | { [param: string]: string | number | boolean | ReadonlyArray<string | number | boolean>; }; 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"; context?: HttpContext; params?: HttpParams | { [param: string]: string | number | boolean | ReadonlyArray<string | number | boolean>; }; 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"; context?: HttpContext; params?: HttpParams | { [param: string]: string | number | boolean | ReadonlyArray<string | number | boolean>; }; 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"; context?: HttpContext; params?: HttpParams | { [param: string]: string | number | boolean | ReadonlyArray<string | number | boolean>; }; 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"; context?: HttpContext; params?: HttpParams | { [param: string]: string | number | boolean | ReadonlyArray<string | number | boolean>; }; 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"; context?: HttpContext; params?: HttpParams | { [param: string]: string | number | boolean | ReadonlyArray<string | number | boolean>; }; 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"; context?: HttpContext; params?: HttpParams | { [param: string]: string | number | boolean | ReadonlyArray<string | number | boolean>; }; 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"; context?: HttpContext; params?: HttpParams | { [param: string]: string | number | boolean | ReadonlyArray<string | number | boolean>; }; 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"; context?: HttpContext; params?: HttpParams | { [param: string]: string | number | boolean | ReadonlyArray<string | number | boolean>; }; 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[]; }; context?: HttpContext; observe?: "body"; params?: HttpParams | { [param: string]: string | number | boolean | ReadonlyArray<string | number | boolean>; }; 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[]; }; context?: HttpContext; observe?: "body"; params?: HttpParams | { [param: string]: string | number | boolean | ReadonlyArray<string | number | boolean>; }; 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[]; }; context?: HttpContext; observe?: "body"; params?: HttpParams | { [param: string]: string | number | boolean | ReadonlyArray<string | number | boolean>; }; 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[]; }; context?: HttpContext; observe?: "body"; params?: HttpParams | { [param: string]: string | number | boolean | ReadonlyArray<string | number | boolean>; }; 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[]; }; context?: HttpContext; observe?: "body"; params?: HttpParams | { [param: string]: string | number | boolean | ReadonlyArray<string | number | boolean>; }; 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 full event stream.

      
      patch(url: string, body: any, options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe: "events"; context?: HttpContext; params?: HttpParams | { [param: string]: string | number | boolean | ReadonlyArray<string | number | boolean>; }; 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"; context?: HttpContext; params?: HttpParams | { [param: string]: string | number | boolean | ReadonlyArray<string | number | boolean>; }; 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"; context?: HttpContext; params?: HttpParams | { [param: string]: string | number | boolean | ReadonlyArray<string | number | boolean>; }; 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 HttpEvents for 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"; context?: HttpContext; params?: HttpParams | { [param: string]: string | number | boolean | ReadonlyArray<string | number | boolean>; }; 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"; context?: HttpContext; params?: HttpParams | { [param: string]: string | number | boolean | ReadonlyArray<string | number | boolean>; }; 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"; context?: HttpContext; params?: HttpParams | { [param: string]: string | number | boolean | ReadonlyArray<string | number | boolean>; }; 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"; context?: HttpContext; params?: HttpParams | { [param: string]: string | number | boolean | ReadonlyArray<string | number | boolean>; }; 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"; context?: HttpContext; params?: HttpParams | { [param: string]: string | number | boolean | ReadonlyArray<string | number | boolean>; }; 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"; context?: HttpContext; params?: HttpParams | { [param: string]: string | number | boolean | ReadonlyArray<string | number | boolean>; }; 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"; context?: HttpContext; params?: HttpParams | { [param: string]: string | number | boolean | ReadonlyArray<string | number | boolean>; }; 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[]; }; context?: HttpContext; observe?: "body"; params?: HttpParams | { [param: string]: string | number | boolean | ReadonlyArray<string | number | boolean>; }; 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[]; }; context?: HttpContext; observe?: "body"; params?: HttpParams | { [param: string]: string | number | boolean | ReadonlyArray<string | number | boolean>; }; 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[]; }; context?: HttpContext; observe?: "body"; params?: HttpParams | { [param: string]: string | number | boolean | ReadonlyArray<string | number | boolean>; }; 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[]; }; context?: HttpContext; observe?: "body"; params?: HttpParams | { [param: string]: string | number | boolean | ReadonlyArray<string | number | boolean>; }; 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[]; }; context?: HttpContext; observe?: "body"; params?: HttpParams | { [param: string]: string | number | boolean | ReadonlyArray<string | number | boolean>; }; 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"; context?: HttpContext; params?: HttpParams | { [param: string]: string | number | boolean | ReadonlyArray<string | number | boolean>; }; 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"; context?: HttpContext; params?: HttpParams | { [param: string]: string | number | boolean | ReadonlyArray<string | number | boolean>; }; 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"; context?: HttpContext; params?: HttpParams | { [param: string]: string | number | boolean | ReadonlyArray<string | number | boolean>; }; 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"; context?: HttpContext; params?: HttpParams | { [param: string]: string | number | boolean | ReadonlyArray<string | number | boolean>; }; 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"; context?: HttpContext; params?: HttpParams | { [param: string]: string | number | boolean | ReadonlyArray<string | number | boolean>; }; 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"; context?: HttpContext; params?: HttpParams | { [param: string]: string | number | boolean | ReadonlyArray<string | number | boolean>; }; 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"; context?: HttpContext; params?: HttpParams | { [param: string]: string | number | boolean | ReadonlyArray<string | number | boolean>; }; 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"; context?: HttpContext; params?: HttpParams | { [param: string]: string | number | boolean | ReadonlyArray<string | number | boolean>; }; 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"; context?: HttpContext; params?: HttpParams | { [param: string]: string | number | boolean | ReadonlyArray<string | number | boolean>; }; 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"; context?: HttpContext; params?: HttpParams | { [param: string]: string | number | boolean | ReadonlyArray<string | number | boolean>; }; 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[]; }; context?: HttpContext; observe?: "body"; params?: HttpParams | { [param: string]: string | number | boolean | ReadonlyArray<string | number | boolean>; }; 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[]; }; context?: HttpContext; observe?: "body"; params?: HttpParams | { [param: string]: string | number | boolean | ReadonlyArray<string | number | boolean>; }; 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[]; }; context?: HttpContext; observe?: "body"; params?: HttpParams | { [param: string]: string | number | boolean | ReadonlyArray<string | number | boolean>; }; 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[]; }; context?: HttpContext; observe?: "body"; params?: HttpParams | { [param: string]: string | number | boolean | ReadonlyArray<string | number | boolean>; }; 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[]; }; context?: HttpContext; observe?: "body"; params?: HttpParams | { [param: string]: string | number | boolean | ReadonlyArray<string | number | boolean>; }; 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"; context?: HttpContext; params?: HttpParams | { [param: string]: string | number | boolean | ReadonlyArray<string | number | boolean>; }; 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"; context?: HttpContext; params?: HttpParams | { [param: string]: string | number | boolean | ReadonlyArray<string | number | boolean>; }; 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"; context?: HttpContext; params?: HttpParams | { [param: string]: string | number | boolean | ReadonlyArray<string | number | boolean>; }; 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"; context?: HttpContext; params?: HttpParams | { [param: string]: string | number | boolean | ReadonlyArray<string | number | boolean>; }; 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"; context?: HttpContext; params?: HttpParams | { [param: string]: string | number | boolean | ReadonlyArray<string | number | boolean>; }; 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"; context?: HttpContext; params?: HttpParams | { [param: string]: string | number | boolean | ReadonlyArray<string | number | boolean>; }; 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"; context?: HttpContext; params?: HttpParams | { [param: string]: string | number | boolean | ReadonlyArray<string | number | boolean>; }; 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"; context?: HttpContext; params?: HttpParams | { [param: string]: string | number | boolean | ReadonlyArray<string | number | boolean>; }; 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"; context?: HttpContext; params?: HttpParams | { [param: string]: string | number | boolean | ReadonlyArray<string | number | boolean>; }; 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"; context?: HttpContext; params?: HttpParams | { [param: string]: string | number | boolean | ReadonlyArray<string | number | boolean>; }; 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[]; }; context?: HttpContext; observe?: "body"; params?: HttpParams | { [param: string]: string | number | boolean | ReadonlyArray<string | number | boolean>; }; 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[]; }; context?: HttpContext; observe?: "body"; params?: HttpParams | { [param: string]: string | number | boolean | ReadonlyArray<string | number | boolean>; }; 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});
}
    

Alternatively, the parameter string can be used without invoking HttpParams by directly joining to the URL.

      
      this.httpClient.request('GET', this.heroesUrl + '?' + 'name=term', {responseType:'json'});
    

JSONP 示例

JSONP Example

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