MCPcopy Create free account
hub / github.com/angular/angular / HttpClient

Class HttpClient

packages/common/http/src/client.ts:96–2667  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

94 */
95@Injectable({providedIn: 'root'})
96export class HttpClient {
97 constructor(private handler: HttpHandler) {}
98
99 /**
100 * Sends an `HttpRequest` and returns a stream of `HttpEvent`s.
101 *
102 * @return An `Observable` of the response, with the response body as a stream of `HttpEvent`s.
103 */
104 request<R>(req: HttpRequest<any>): Observable<HttpEvent<R>>;
105
106 /**
107 * Constructs a request that interprets the body as an `ArrayBuffer` and returns the response in
108 * an `ArrayBuffer`.
109 *
110 * @param method The HTTP method.
111 * @param url The endpoint URL.
112 * @param options The HTTP options to send with the request.
113 *
114 *
115 * @return An `Observable` of the response, with the response body as an `ArrayBuffer`.
116 */
117 request(
118 method: string,
119 url: string,
120 options: {
121 body?: any;
122 observe?: 'body';
123 responseType: 'arraybuffer';
124 } & HttpClientCommonOptions,
125 ): Observable<ArrayBuffer>;
126
127 /**
128 * Constructs a request that interprets the body as a blob and returns
129 * the response as a blob.
130 *
131 * @param method The HTTP method.
132 * @param url The endpoint URL.
133 * @param options The HTTP options to send with the request.
134 *
135 * @return An `Observable` of the response, with the response body of type `Blob`.
136 */
137 request(
138 method: string,
139 url: string,
140 options: {
141 body?: any;
142 observe?: 'body';
143 responseType: 'blob';
144 } & HttpClientCommonOptions,
145 ): Observable<Blob>;
146
147 /**
148 * Constructs a request that interprets the body as a text string and
149 * returns a string value.
150 *
151 * @param method The HTTP method.
152 * @param url The endpoint URL.
153 * @param options The HTTP options to send with the request.

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected