• Overview
@angular/common/http

HttpRequest

Class

An outgoing HTTP request with an optional typed body.

  
    class HttpRequest<T> {
}

body

T | null

The request body, or null if one isn't set.

Bodies are not enforced to be immutable, as they can include a reference to any user-defined data type. However, interceptors should take care to preserve idempotence by treating them as such.

Outgoing headers for this request.

Shared and mutable context that can be used by interceptors

reportProgress

boolean

Whether this request should be made in a way that exposes progress events.

Progress events are expensive (change detection runs on each event) and so they should only be requested if the consumer intends to monitor them.

Note: The FetchBackend doesn't support progress report on uploads.

withCredentials

boolean

Whether this request should be sent with outgoing credentials (cookies).

responseType

"blob" | "text" | "arraybuffer" | "json"

The expected response type of the server.

This is used to parse the response appropriately before returning it to the requestee.

method

string

The outgoing HTTP request method.

Outgoing URL parameters.

To pass a string representation of HTTP parameters in the URL-query-string format, the HttpParamsOptions' fromString may be used. For example:

          
new HttpParams({fromString: 'angular=awesome'})

urlWithParams

string

The outgoing URL with all URL parameters set.

transferCache

boolean | { includeHeaders?: string[] | undefined; } | undefined

The HttpTransferCache option for the request

serializeBody

string | ArrayBuffer | Blob | FormData | URLSearchParams | null

Transform the free-form body into a serialized format suitable for transmission to the server.

@returnsstring | ArrayBuffer | Blob | FormData | URLSearchParams | null

detectContentTypeHeader

string | null

Examine the body and attempt to infer an appropriate MIME type for it.

If no such type can be inferred, this method will return null.

@returnsstring | null

clone

3 overloads
@returnsHttpRequest<T>
@paramupdate{ headers?: HttpHeaders | undefined; context?: HttpContext | undefined; reportProgress?: boolean | undefined; params?: HttpParams | undefined; ... 7 more ...; setParams?: { ...; } | undefined; }
@returnsHttpRequest<T>
@paramupdate{ headers?: HttpHeaders | undefined; context?: HttpContext | undefined; reportProgress?: boolean | undefined; params?: HttpParams | undefined; ... 7 more ...; setParams?: { ...; } | undefined; }
@returnsHttpRequest<V>
Jump to details