fix(common): document HttpClient, fixing a few other issues

This commit is contained in:
Alex Rickabaugh 2017-07-12 17:00:23 -07:00 committed by Igor Minar
parent ce0f4f0d7c
commit 18559897a0
6 changed files with 1178 additions and 310 deletions

View File

@ -11,6 +11,15 @@ import {HttpRequest} from './request';
import {HttpEvent} from './response';
/**
* Transforms an `HttpRequest` into a stream of `HttpEvent`s, one of which will likely be a
* `HttpResponse`.
*
* `HttpHandler` is injectable. When injected, the handler instance dispatches requests to the
* first interceptor in the chain, which dispatches to the second, etc, eventually reaching the
* `HttpBackend`.
*
* In an `HttpInterceptor`, the `HttpHandler` parameter is the next interceptor in the chain.
*
* @experimental
*/
export abstract class HttpHandler {
@ -18,6 +27,13 @@ export abstract class HttpHandler {
}
/**
* A final `HttpHandler` which will dispatch the request via browser HTTP APIs to a backend.
*
* Interceptors sit between the `HttpClient` interface and the `HttpBackend`.
*
* When injected, `HttpBackend` dispatches requests directly to the backend, without going
* through the interceptor chain.
*
* @experimental
*/
export abstract class HttpBackend implements HttpHandler {

File diff suppressed because it is too large Load Diff

View File

@ -32,22 +32,86 @@ export abstract class HttpTestingController {
*/
abstract match(match: string|RequestMatch|((req: HttpRequest<any>) => boolean)): TestRequest[];
// Expect that exactly one request matches the given parameter.
/**
* Expect that a single request has been made which matches the given URL, and return its
* mock.
*
* If no such request has been made, or more than one such request has been made, fail with an
* error message including the given request description, if any.
*/
abstract expectOne(url: string, description?: string): TestRequest;
/**
* Expect that a single request has been made which matches the given parameters, and return
* its mock.
*
* If no such request has been made, or more than one such request has been made, fail with an
* error message including the given request description, if any.
*/
abstract expectOne(params: RequestMatch, description?: string): TestRequest;
/**
* Expect that a single request has been made which matches the given predicate function, and
* return its mock.
*
* If no such request has been made, or more than one such request has been made, fail with an
* error message including the given request description, if any.
*/
abstract expectOne(matchFn: ((req: HttpRequest<any>) => boolean), description?: string):
TestRequest;
/**
* Expect that a single request has been made which matches the given condition, and return
* its mock.
*
* If no such request has been made, or more than one such request has been made, fail with an
* error message including the given request description, if any.
*/
abstract expectOne(
match: string|RequestMatch|((req: HttpRequest<any>) => boolean),
description?: string): TestRequest;
// Assert that no requests match the given parameter.
/**
* Expect that no requests have been made which match the given URL.
*
* If a matching request has been made, fail with an error message including the given request
* description, if any.
*/
abstract expectNone(url: string, description?: string): void;
/**
* Expect that no requests have been made which match the given parameters.
*
* If a matching request has been made, fail with an error message including the given request
* description, if any.
*/
abstract expectNone(params: RequestMatch, description?: string): void;
/**
* Expect that no requests have been made which match the given predicate function.
*
* If a matching request has been made, fail with an error message including the given request
* description, if any.
*/
abstract expectNone(matchFn: ((req: HttpRequest<any>) => boolean), description?: string): void;
/**
* Expect that no requests have been made which match the given condition.
*
* If a matching request has been made, fail with an error message including the given request
* description, if any.
*/
abstract expectNone(
match: string|RequestMatch|((req: HttpRequest<any>) => boolean), description?: string): void;
// Validate that all requests which were issued were flushed.
/**
* Verify that no unmatched requests are outstanding.
*
* If any requests are outstanding, fail with an error message indicating which requests were not
* handled.
*
* If `ignoreCancelled` is not set (the default), `verify()` will also fail if cancelled requests
* were not explicitly matched.
*/
abstract verify(opts?: {ignoreCancelled?: boolean}): void;
}

View File

@ -38,10 +38,10 @@ export class HttpClientTestingBackend implements HttpBackend, HttpTestingControl
* Handle an incoming request by queueing it in the list of open requests.
*/
handle(req: HttpRequest<any>): Observable<HttpEvent<any>> {
return new Observable((observer: Observer<HttpEvent<any>>) => {
return new Observable((observer: Observer<any>) => {
const testReq = new TestRequest(req, observer);
this.open.push(testReq);
observer.next({type: HttpEventType.Sent});
observer.next({ type: HttpEventType.Sent } as HttpEvent<any>);
return () => { testReq._cancelled = true; };
});
}

View File

@ -30,7 +30,12 @@ export class TestRequest {
constructor(public request: HttpRequest<any>, private observer: Observer<HttpEvent<any>>) {}
/**
* Resolve the request by returning a body plus additional HTTP information (such as response
* headers) if provided.
*
* Both successful and unsuccessful responses can be delivered via `flush()`.
*/
flush(body: ArrayBuffer|Blob|string|number|Object|(string|number|Object|null)[]|null, opts: {
headers?: HttpHeaders | {[name: string]: string | string[]},
status?: number,
@ -65,6 +70,9 @@ export class TestRequest {
}
}
/**
* Resolve the request by returning an `ErrorEvent` (e.g. simulating a network failure).
*/
error(error: ErrorEvent, opts: {
headers?: HttpHeaders | {[name: string]: string | string[]},
status?: number,
@ -87,6 +95,10 @@ export class TestRequest {
}));
}
/**
* Deliver an arbitrary `HttpEvent` (such as a progress event) on the response stream for this
* request.
*/
event(event: HttpEvent<any>): void {
if (this.cancelled) {
throw new Error(`Cannot send events to a cancelled request.`);

View File

@ -23,83 +23,6 @@ export declare class HttpClient {
responseType?: 'json';
withCredentials?: boolean;
}): Observable<Object>;
delete<T>(url: string, options: {
headers?: HttpHeaders;
observe: 'response';
params?: HttpParams;
responseType?: 'json';
withCredentials?: boolean;
}): Observable<HttpResponse<T>>;
delete(url: string, options: {
headers?: HttpHeaders;
observe: 'response';
params?: HttpParams;
responseType?: 'json';
withCredentials?: boolean;
}): Observable<HttpResponse<Object>>;
delete(url: string, options: {
headers?: HttpHeaders;
observe: 'response';
params?: HttpParams;
responseType: 'text';
withCredentials?: boolean;
}): Observable<HttpResponse<string>>;
delete(url: string, options: {
headers?: HttpHeaders;
observe: 'response';
params?: HttpParams;
responseType: 'blob';
withCredentials?: boolean;
}): Observable<HttpResponse<Blob>>;
delete(url: string, options: {
headers?: HttpHeaders;
observe: 'response';
params?: HttpParams;
responseType: 'arraybuffer';
withCredentials?: boolean;
}): Observable<HttpResponse<ArrayBuffer>>;
delete<T>(url: string, options: {
headers?: HttpHeaders;
observe: 'events';
params?: HttpParams;
responseType?: 'json';
withCredentials?: boolean;
}): Observable<HttpEvent<T>>;
delete(url: string, options: {
headers?: HttpHeaders;
observe: 'events';
params?: HttpParams;
responseType?: 'json';
withCredentials?: boolean;
}): Observable<HttpEvent<Object>>;
delete(url: string, options: {
headers?: HttpHeaders;
observe: 'events';
params?: HttpParams;
responseType: 'text';
withCredentials?: boolean;
}): Observable<HttpEvent<string>>;
delete(url: string, options: {
headers?: HttpHeaders;
observe: 'events';
params?: HttpParams;
responseType: 'blob';
withCredentials?: boolean;
}): Observable<HttpEvent<Blob>>;
delete(url: string, options: {
headers?: HttpHeaders;
observe: 'events';
params?: HttpParams;
responseType: 'arraybuffer';
withCredentials?: boolean;
}): Observable<HttpEvent<ArrayBuffer>>;
delete(url: string, options: {
headers?: HttpHeaders;
observe?: 'body';
params?: HttpParams;
responseType: 'text';
withCredentials?: boolean;
}): Observable<string>;
delete(url: string, options: {
headers?: HttpHeaders;
observe?: 'body';
@ -114,41 +37,83 @@ export declare class HttpClient {
responseType: 'blob';
withCredentials?: boolean;
}): Observable<Blob>;
get<T>(url: string, options: {
headers?: HttpHeaders;
observe: 'events';
params?: HttpParams;
responseType?: 'json';
withCredentials?: boolean;
}): Observable<HttpEvent<T>>;
get(url: string, options: {
delete(url: string, options: {
headers?: HttpHeaders;
observe?: 'body';
params?: HttpParams;
responseType: 'text';
withCredentials?: boolean;
}): Observable<string>;
get(url: string, options: {
headers?: HttpHeaders;
observe?: 'body';
params?: HttpParams;
responseType: 'blob';
withCredentials?: boolean;
}): Observable<Blob>;
get(url: string, options: {
delete(url: string, options: {
headers?: HttpHeaders;
observe: 'events';
params?: HttpParams;
responseType: 'arraybuffer';
withCredentials?: boolean;
}): Observable<HttpEvent<ArrayBuffer>>;
get(url: string, options: {
delete(url: string, options: {
headers?: HttpHeaders;
observe: 'events';
params?: HttpParams;
responseType: 'blob';
withCredentials?: boolean;
}): Observable<HttpEvent<Blob>>;
delete(url: string, options: {
headers?: HttpHeaders;
observe: 'events';
params?: HttpParams;
responseType: 'text';
withCredentials?: boolean;
}): Observable<HttpEvent<string>>;
delete(url: string, options: {
headers?: HttpHeaders;
observe: 'events';
params?: HttpParams;
responseType?: 'json';
withCredentials?: boolean;
}): Observable<HttpEvent<Object>>;
delete<T>(url: string, options: {
headers?: HttpHeaders;
observe: 'events';
params?: HttpParams;
responseType?: 'json';
withCredentials?: boolean;
}): Observable<HttpEvent<T>>;
delete(url: string, options: {
headers?: HttpHeaders;
observe: 'response';
params?: HttpParams;
responseType: 'arraybuffer';
withCredentials?: boolean;
}): Observable<HttpResponse<ArrayBuffer>>;
delete(url: string, options: {
headers?: HttpHeaders;
observe: 'response';
params?: HttpParams;
responseType: 'blob';
withCredentials?: boolean;
}): Observable<HttpResponse<Blob>>;
delete(url: string, options: {
headers?: HttpHeaders;
observe: 'response';
params?: HttpParams;
responseType: 'text';
withCredentials?: boolean;
}): Observable<HttpResponse<string>>;
delete(url: string, options: {
headers?: HttpHeaders;
observe: 'response';
params?: HttpParams;
responseType?: 'json';
withCredentials?: boolean;
}): Observable<HttpResponse<Object>>;
delete<T>(url: string, options: {
headers?: HttpHeaders;
observe: 'response';
params?: HttpParams;
responseType?: 'json';
withCredentials?: boolean;
}): Observable<HttpResponse<T>>;
get(url: string, options: {
headers?: HttpHeaders;
observe: 'events';
@ -156,55 +121,6 @@ export declare class HttpClient {
responseType: 'text';
withCredentials?: boolean;
}): Observable<HttpEvent<string>>;
get(url: string, options: {
headers?: HttpHeaders;
observe: 'events';
params?: HttpParams;
responseType?: 'json';
withCredentials?: boolean;
}): Observable<HttpEvent<Object>>;
get(url: string, options: {
headers?: HttpHeaders;
observe?: 'body';
params?: HttpParams;
responseType: 'arraybuffer';
withCredentials?: boolean;
}): Observable<ArrayBuffer>;
get(url: string, options: {
headers?: HttpHeaders;
observe: 'response';
params?: HttpParams;
responseType: 'arraybuffer';
withCredentials?: boolean;
}): Observable<HttpResponse<ArrayBuffer>>;
get(url: string, options: {
headers?: HttpHeaders;
observe: 'response';
params?: HttpParams;
responseType: 'blob';
withCredentials?: boolean;
}): Observable<HttpResponse<Blob>>;
get(url: string, options: {
headers?: HttpHeaders;
observe: 'response';
params?: HttpParams;
responseType: 'text';
withCredentials?: boolean;
}): Observable<HttpResponse<string>>;
get(url: string, options: {
headers?: HttpHeaders;
observe: 'response';
params?: HttpParams;
responseType?: 'json';
withCredentials?: boolean;
}): Observable<HttpResponse<Object>>;
get<T>(url: string, options: {
headers?: HttpHeaders;
observe: 'response';
params?: HttpParams;
responseType?: 'json';
withCredentials?: boolean;
}): Observable<HttpResponse<T>>;
get(url: string, options?: {
headers?: HttpHeaders;
observe?: 'body';
@ -212,6 +128,41 @@ export declare class HttpClient {
responseType?: 'json';
withCredentials?: boolean;
}): Observable<Object>;
get(url: string, options: {
headers?: HttpHeaders;
observe?: 'body';
params?: HttpParams;
responseType: 'arraybuffer';
withCredentials?: boolean;
}): Observable<ArrayBuffer>;
get(url: string, options: {
headers?: HttpHeaders;
observe?: 'body';
params?: HttpParams;
responseType: 'blob';
withCredentials?: boolean;
}): Observable<Blob>;
get(url: string, options: {
headers?: HttpHeaders;
observe?: 'body';
params?: HttpParams;
responseType: 'text';
withCredentials?: boolean;
}): Observable<string>;
get(url: string, options: {
headers?: HttpHeaders;
observe: 'events';
params?: HttpParams;
responseType: 'arraybuffer';
withCredentials?: boolean;
}): Observable<HttpEvent<ArrayBuffer>>;
get(url: string, options: {
headers?: HttpHeaders;
observe: 'events';
params?: HttpParams;
responseType: 'blob';
withCredentials?: boolean;
}): Observable<HttpEvent<Blob>>;
get<T>(url: string, options?: {
headers?: HttpHeaders;
observe?: 'body';
@ -219,48 +170,83 @@ export declare class HttpClient {
responseType?: 'json';
withCredentials?: boolean;
}): Observable<T>;
head(url: string, options: {
headers?: HttpHeaders;
observe: 'events';
params?: HttpParams;
responseType: 'arraybuffer';
withCredentials?: boolean;
}): Observable<HttpEvent<ArrayBuffer>>;
head(url: string, options: {
headers?: HttpHeaders;
observe: 'events';
params?: HttpParams;
responseType: 'text';
withCredentials?: boolean;
}): Observable<HttpEvent<string>>;
head(url: string, options: {
get(url: string, options: {
headers?: HttpHeaders;
observe: 'events';
params?: HttpParams;
responseType?: 'json';
withCredentials?: boolean;
}): Observable<HttpEvent<Object>>;
head<T>(url: string, options: {
get<T>(url: string, options: {
headers?: HttpHeaders;
observe: 'events';
params?: HttpParams;
responseType?: 'json';
withCredentials?: boolean;
}): Observable<HttpEvent<T>>;
head(url: string, options: {
get(url: string, options: {
headers?: HttpHeaders;
observe: 'response';
params?: HttpParams;
responseType: 'arraybuffer';
withCredentials?: boolean;
}): Observable<HttpResponse<ArrayBuffer>>;
head(url: string, options: {
get(url: string, options: {
headers?: HttpHeaders;
observe: 'response';
params?: HttpParams;
responseType: 'blob';
withCredentials?: boolean;
}): Observable<HttpResponse<Blob>>;
get(url: string, options: {
headers?: HttpHeaders;
observe: 'response';
params?: HttpParams;
responseType: 'text';
withCredentials?: boolean;
}): Observable<HttpResponse<string>>;
get(url: string, options: {
headers?: HttpHeaders;
observe: 'response';
params?: HttpParams;
responseType?: 'json';
withCredentials?: boolean;
}): Observable<HttpResponse<Object>>;
get<T>(url: string, options: {
headers?: HttpHeaders;
observe: 'response';
params?: HttpParams;
responseType?: 'json';
withCredentials?: boolean;
}): Observable<HttpResponse<T>>;
head<T>(url: string, options?: {
headers?: HttpHeaders;
observe?: 'body';
params?: HttpParams;
responseType?: 'json';
withCredentials?: boolean;
}): Observable<T>;
head(url: string, options?: {
headers?: HttpHeaders;
observe?: 'body';
params?: HttpParams;
responseType?: 'json';
withCredentials?: boolean;
}): Observable<Object>;
head<T>(url: string, options: {
headers?: HttpHeaders;
observe: 'response';
params?: HttpParams;
responseType?: 'json';
withCredentials?: boolean;
}): Observable<HttpResponse<T>>;
head(url: string, options: {
headers?: HttpHeaders;
observe: 'response';
params?: HttpParams;
responseType?: 'json';
withCredentials?: boolean;
}): Observable<HttpResponse<Object>>;
head(url: string, options: {
headers?: HttpHeaders;
observe: 'response';
@ -272,37 +258,37 @@ export declare class HttpClient {
headers?: HttpHeaders;
observe: 'response';
params?: HttpParams;
responseType?: 'json';
responseType: 'blob';
withCredentials?: boolean;
}): Observable<HttpResponse<Object>>;
head<T>(url: string, options: {
}): Observable<HttpResponse<Blob>>;
head(url: string, options: {
headers?: HttpHeaders;
observe: 'response';
params?: HttpParams;
responseType?: 'json';
responseType: 'arraybuffer';
withCredentials?: boolean;
}): Observable<HttpResponse<T>>;
head(url: string, options?: {
}): Observable<HttpResponse<ArrayBuffer>>;
head<T>(url: string, options: {
headers?: HttpHeaders;
observe?: 'body';
observe: 'events';
params?: HttpParams;
responseType?: 'json';
withCredentials?: boolean;
}): Observable<Object>;
head<T>(url: string, options?: {
headers?: HttpHeaders;
observe?: 'body';
params?: HttpParams;
responseType?: 'json';
withCredentials?: boolean;
}): Observable<T>;
}): Observable<HttpEvent<T>>;
head(url: string, options: {
headers?: HttpHeaders;
observe?: 'body';
observe: 'events';
params?: HttpParams;
responseType?: 'json';
withCredentials?: boolean;
}): Observable<HttpEvent<Object>>;
head(url: string, options: {
headers?: HttpHeaders;
observe: 'events';
params?: HttpParams;
responseType: 'text';
withCredentials?: boolean;
}): Observable<string>;
}): Observable<HttpEvent<string>>;
head(url: string, options: {
headers?: HttpHeaders;
observe: 'events';
@ -312,11 +298,18 @@ export declare class HttpClient {
}): Observable<HttpEvent<Blob>>;
head(url: string, options: {
headers?: HttpHeaders;
observe?: 'body';
observe: 'events';
params?: HttpParams;
responseType: 'arraybuffer';
withCredentials?: boolean;
}): Observable<ArrayBuffer>;
}): Observable<HttpEvent<ArrayBuffer>>;
head(url: string, options: {
headers?: HttpHeaders;
observe?: 'body';
params?: HttpParams;
responseType: 'text';
withCredentials?: boolean;
}): Observable<string>;
head(url: string, options: {
headers?: HttpHeaders;
observe?: 'body';
@ -324,15 +317,22 @@ export declare class HttpClient {
responseType: 'blob';
withCredentials?: boolean;
}): Observable<Blob>;
jsonp(url: string, callbackParam: string): Observable<any>;
jsonp<T>(url: string, callbackParam: string): Observable<T>;
options(url: string, options: {
head(url: string, options: {
headers?: HttpHeaders;
observe: 'response';
observe?: 'body';
params?: HttpParams;
responseType: 'arraybuffer';
withCredentials?: boolean;
}): Observable<HttpResponse<ArrayBuffer>>;
}): Observable<ArrayBuffer>;
jsonp<T>(url: string, callbackParam: string): Observable<T>;
jsonp(url: string, callbackParam: string): Observable<Object>;
options(url: string, options: {
headers?: HttpHeaders;
observe: 'events';
params?: HttpParams;
responseType?: 'json';
withCredentials?: boolean;
}): Observable<HttpEvent<Object>>;
options(url: string, options: {
headers?: HttpHeaders;
observe?: 'body';
@ -340,6 +340,13 @@ export declare class HttpClient {
responseType: 'arraybuffer';
withCredentials?: boolean;
}): Observable<ArrayBuffer>;
options(url: string, options: {
headers?: HttpHeaders;
observe?: 'body';
params?: HttpParams;
responseType: 'blob';
withCredentials?: boolean;
}): Observable<Blob>;
options(url: string, options: {
headers?: HttpHeaders;
observe?: 'body';
@ -368,13 +375,13 @@ export declare class HttpClient {
responseType: 'text';
withCredentials?: boolean;
}): Observable<HttpEvent<string>>;
options(url: string, options: {
options<T>(url: string, options?: {
headers?: HttpHeaders;
observe: 'events';
observe?: 'body';
params?: HttpParams;
responseType?: 'json';
withCredentials?: boolean;
}): Observable<HttpEvent<Object>>;
}): Observable<T>;
options<T>(url: string, options: {
headers?: HttpHeaders;
observe: 'events';
@ -384,11 +391,11 @@ export declare class HttpClient {
}): Observable<HttpEvent<T>>;
options(url: string, options: {
headers?: HttpHeaders;
observe?: 'body';
observe: 'response';
params?: HttpParams;
responseType: 'blob';
responseType: 'arraybuffer';
withCredentials?: boolean;
}): Observable<Blob>;
}): Observable<HttpResponse<ArrayBuffer>>;
options(url: string, options: {
headers?: HttpHeaders;
observe: 'response';
@ -424,20 +431,20 @@ export declare class HttpClient {
responseType?: 'json';
withCredentials?: boolean;
}): Observable<Object>;
options<T>(url: string, options?: {
headers?: HttpHeaders;
observe?: 'body';
params?: HttpParams;
responseType?: 'json';
withCredentials?: boolean;
}): Observable<T>;
patch(url: string, body: any | null, options: {
headers?: HttpHeaders;
observe: 'events';
params?: HttpParams;
responseType?: 'json';
responseType: 'blob';
withCredentials?: boolean;
}): Observable<HttpEvent<Object>>;
}): Observable<HttpEvent<Blob>>;
patch(url: string, body: any | null, options: {
headers?: HttpHeaders;
observe: 'events';
params?: HttpParams;
responseType: 'text';
withCredentials?: boolean;
}): Observable<HttpEvent<string>>;
patch(url: string, body: any | null, options: {
headers?: HttpHeaders;
observe?: 'body';
@ -466,69 +473,6 @@ export declare class HttpClient {
responseType: 'arraybuffer';
withCredentials?: boolean;
}): Observable<HttpEvent<ArrayBuffer>>;
patch(url: string, body: any | null, options: {
headers?: HttpHeaders;
observe: 'events';
params?: HttpParams;
responseType: 'blob';
withCredentials?: boolean;
}): Observable<HttpEvent<Blob>>;
patch(url: string, body: any | null, options: {
headers?: HttpHeaders;
observe: 'events';
params?: HttpParams;
responseType: 'text';
withCredentials?: boolean;
}): Observable<HttpEvent<string>>;
patch<T>(url: string, body: any | null, options: {
headers?: HttpHeaders;
observe: 'events';
params?: HttpParams;
responseType?: 'json';
withCredentials?: boolean;
}): Observable<HttpEvent<T>>;
patch(url: string, body: any | null, options: {
headers?: HttpHeaders;
observe: 'response';
params?: HttpParams;
responseType: 'arraybuffer';
withCredentials?: boolean;
}): Observable<HttpResponse<ArrayBuffer>>;
patch(url: string, body: any | null, options: {
headers?: HttpHeaders;
observe: 'response';
params?: HttpParams;
responseType: 'blob';
withCredentials?: boolean;
}): Observable<HttpResponse<Blob>>;
patch(url: string, body: any | null, options: {
headers?: HttpHeaders;
observe: 'response';
params?: HttpParams;
responseType: 'text';
withCredentials?: boolean;
}): Observable<HttpResponse<string>>;
patch(url: string, body: any | null, options: {
headers?: HttpHeaders;
observe: 'response';
params?: HttpParams;
responseType?: 'json';
withCredentials?: boolean;
}): Observable<HttpResponse<Object>>;
patch<T>(url: string, body: any | null, options: {
headers?: HttpHeaders;
observe: 'response';
params?: HttpParams;
responseType?: 'json';
withCredentials?: boolean;
}): Observable<HttpResponse<T>>;
patch(url: string, body: any | null, options?: {
headers?: HttpHeaders;
observe?: 'body';
params?: HttpParams;
responseType?: 'json';
withCredentials?: boolean;
}): Observable<Object>;
patch<T>(url: string, body: any | null, options?: {
headers?: HttpHeaders;
observe?: 'body';
@ -536,13 +480,76 @@ export declare class HttpClient {
responseType?: 'json';
withCredentials?: boolean;
}): Observable<T>;
post<T>(url: string, body: any | null, options: {
patch(url: string, body: any | null, options?: {
headers?: HttpHeaders;
observe?: 'body';
params?: HttpParams;
responseType?: 'json';
withCredentials?: boolean;
}): Observable<Object>;
patch(url: string, body: any | null, options: {
headers?: HttpHeaders;
observe: 'events';
params?: HttpParams;
responseType?: 'json';
withCredentials?: boolean;
}): Observable<HttpEvent<Object>>;
patch<T>(url: string, body: any | null, options: {
headers?: HttpHeaders;
observe: 'events';
params?: HttpParams;
responseType?: 'json';
withCredentials?: boolean;
}): Observable<HttpEvent<T>>;
patch(url: string, body: any | null, options: {
headers?: HttpHeaders;
observe: 'response';
params?: HttpParams;
responseType: 'arraybuffer';
withCredentials?: boolean;
}): Observable<HttpResponse<ArrayBuffer>>;
patch(url: string, body: any | null, options: {
headers?: HttpHeaders;
observe: 'response';
params?: HttpParams;
responseType: 'blob';
withCredentials?: boolean;
}): Observable<HttpResponse<Blob>>;
patch(url: string, body: any | null, options: {
headers?: HttpHeaders;
observe: 'response';
params?: HttpParams;
responseType: 'text';
withCredentials?: boolean;
}): Observable<HttpResponse<string>>;
patch(url: string, body: any | null, options: {
headers?: HttpHeaders;
observe: 'response';
params?: HttpParams;
responseType?: 'json';
withCredentials?: boolean;
}): Observable<HttpResponse<Object>>;
patch<T>(url: string, body: any | null, options: {
headers?: HttpHeaders;
observe: 'response';
params?: HttpParams;
responseType?: 'json';
withCredentials?: boolean;
}): Observable<HttpResponse<T>>;
post(url: string, body: any | null, options: {
headers?: HttpHeaders;
observe: 'events';
params?: HttpParams;
responseType: 'text';
withCredentials?: boolean;
}): Observable<HttpEvent<string>>;
post(url: string, body: any | null, options?: {
headers?: HttpHeaders;
observe?: 'body';
params?: HttpParams;
responseType?: 'json';
withCredentials?: boolean;
}): Observable<Object>;
post(url: string, body: any | null, options: {
headers?: HttpHeaders;
observe?: 'body';
@ -550,6 +557,13 @@ export declare class HttpClient {
responseType: 'arraybuffer';
withCredentials?: boolean;
}): Observable<ArrayBuffer>;
post(url: string, body: any | null, options: {
headers?: HttpHeaders;
observe?: 'body';
params?: HttpParams;
responseType: 'blob';
withCredentials?: boolean;
}): Observable<Blob>;
post(url: string, body: any | null, options: {
headers?: HttpHeaders;
observe?: 'body';
@ -571,13 +585,13 @@ export declare class HttpClient {
responseType: 'blob';
withCredentials?: boolean;
}): Observable<HttpEvent<Blob>>;
post(url: string, body: any | null, options: {
post<T>(url: string, body: any | null, options?: {
headers?: HttpHeaders;
observe: 'events';
observe?: 'body';
params?: HttpParams;
responseType: 'text';
responseType?: 'json';
withCredentials?: boolean;
}): Observable<HttpEvent<string>>;
}): Observable<T>;
post(url: string, body: any | null, options: {
headers?: HttpHeaders;
observe: 'events';
@ -585,13 +599,13 @@ export declare class HttpClient {
responseType?: 'json';
withCredentials?: boolean;
}): Observable<HttpEvent<Object>>;
post(url: string, body: any | null, options: {
post<T>(url: string, body: any | null, options: {
headers?: HttpHeaders;
observe?: 'body';
observe: 'events';
params?: HttpParams;
responseType: 'blob';
responseType?: 'json';
withCredentials?: boolean;
}): Observable<Blob>;
}): Observable<HttpEvent<T>>;
post(url: string, body: any | null, options: {
headers?: HttpHeaders;
observe: 'response';
@ -627,20 +641,6 @@ export declare class HttpClient {
responseType?: 'json';
withCredentials?: boolean;
}): Observable<HttpResponse<T>>;
post(url: string, body: any | null, options?: {
headers?: HttpHeaders;
observe?: 'body';
params?: HttpParams;
responseType?: 'json';
withCredentials?: boolean;
}): Observable<Object>;
post<T>(url: string, body: any | null, options?: {
headers?: HttpHeaders;
observe?: 'body';
params?: HttpParams;
responseType?: 'json';
withCredentials?: boolean;
}): Observable<T>;
put(url: string, body: any | null, options?: {
headers?: HttpHeaders;
observe?: 'body';
@ -689,13 +689,6 @@ export declare class HttpClient {
responseType?: 'json';
withCredentials?: boolean;
}): Observable<HttpEvent<T>>;
put(url: string, body: any | null, options: {
headers?: HttpHeaders;
observe?: 'body';
params?: HttpParams;
responseType: 'arraybuffer';
withCredentials?: boolean;
}): Observable<ArrayBuffer>;
put(url: string, body: any | null, options: {
headers?: HttpHeaders;
observe: 'events';
@ -738,6 +731,13 @@ export declare class HttpClient {
responseType: 'blob';
withCredentials?: boolean;
}): Observable<Blob>;
put(url: string, body: any | null, options: {
headers?: HttpHeaders;
observe?: 'body';
params?: HttpParams;
responseType: 'arraybuffer';
withCredentials?: boolean;
}): Observable<ArrayBuffer>;
put<T>(url: string, body: any | null, options?: {
headers?: HttpHeaders;
observe?: 'body';
@ -750,9 +750,9 @@ export declare class HttpClient {
headers?: HttpHeaders;
observe: 'events';
params?: HttpParams;
responseType: 'text';
responseType?: 'json';
withCredentials?: boolean;
}): Observable<HttpEvent<string>>;
}): Observable<HttpEvent<any>>;
request<R>(method: string, url: string, options?: {
body?: any;
headers?: HttpHeaders;
@ -801,6 +801,14 @@ export declare class HttpClient {
responseType: 'blob';
withCredentials?: boolean;
}): Observable<HttpEvent<Blob>>;
request(method: string, url: string, options: {
body?: any;
headers?: HttpHeaders;
observe: 'events';
params?: HttpParams;
responseType: 'text';
withCredentials?: boolean;
}): Observable<HttpEvent<string>>;
request<R>(req: HttpRequest<any>): Observable<HttpEvent<R>>;
request<R>(method: string, url: string, options: {
body?: any;
@ -834,6 +842,14 @@ export declare class HttpClient {
responseType: 'text';
withCredentials?: boolean;
}): Observable<HttpResponse<string>>;
request(method: string, url: string, options: {
body?: any;
headers?: HttpHeaders;
observe: 'response';
params?: HttpParams;
responseType?: 'json';
withCredentials?: boolean;
}): Observable<HttpResponse<Object>>;
request<R>(method: string, url: string, options: {
body?: any;
headers?: HttpHeaders;