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

Class HttpClient

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

Source from the content-addressed store, hash-verified

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