feat(common): two missing features in HttpClient (#17996)

- Add params to HttpRequest API
- Add optional description to testing APIs
This commit is contained in:
Alex Rickabaugh
2017-07-07 14:56:36 -07:00
committed by Jason Aden
parent 37797e2b4e
commit c81ad9d19d
14 changed files with 487 additions and 198 deletions

View File

@ -15,6 +15,7 @@ import {map} from 'rxjs/operator/map';
import {HttpHandler} from './backend';
import {HttpHeaders} from './headers';
import {HttpParams} from './params';
import {HttpRequest} from './request';
import {HttpEvent, HttpEventType, HttpResponse} from './response';
@ -27,6 +28,7 @@ function addBody<T>(
options: {
headers?: HttpHeaders,
observe?: HttpObserve,
params?: HttpParams,
responseType?: 'arraybuffer' | 'blob' | 'json' | 'text',
withCredentials?: boolean,
},
@ -35,6 +37,7 @@ function addBody<T>(
body,
headers: options.headers,
observe: options.observe,
params: options.params,
responseType: options.responseType,
withCredentials: options.withCredentials,
};
@ -59,70 +62,75 @@ export class HttpClient {
body?: any,
headers?: HttpHeaders,
observe?: 'body',
params?: HttpParams,
responseType: 'arraybuffer', withCredentials?: boolean,
}): Observable<ArrayBuffer>;
request(method: string, url: string, options: {
body?: any,
headers?: HttpHeaders,
observe?: 'body',
params?: HttpParams,
responseType: 'blob', withCredentials?: boolean,
}): Observable<Blob>;
request(method: string, url: string, options: {
body?: any,
headers?: HttpHeaders,
observe?: 'body',
params?: HttpParams,
responseType: 'text', withCredentials?: boolean,
}): Observable<string>;
request(method: string, url: string, options: {
body?: any,
headers?: HttpHeaders,
params?: HttpParams,
observe: 'events',
responseType: 'arraybuffer', withCredentials?: boolean,
}): Observable<HttpEvent<ArrayBuffer>>;
request(method: string, url: string, options: {
body?: any,
headers?: HttpHeaders,
observe: 'events',
observe: 'events', params?: HttpParams,
responseType: 'blob', withCredentials?: boolean,
}): Observable<HttpEvent<Blob>>;
request(method: string, url: string, options: {
body?: any,
headers?: HttpHeaders,
observe: 'events',
observe: 'events', params?: HttpParams,
responseType: 'text', withCredentials?: boolean,
}): Observable<HttpEvent<string>>;
request<R>(method: string, url: string, options: {
body?: any,
headers?: HttpHeaders,
observe: 'events', responseType?: 'json', withCredentials?: boolean,
observe: 'events', params?: HttpParams, responseType?: 'json', withCredentials?: boolean,
}): Observable<HttpEvent<R>>;
request(method: string, url: string, options: {
body?: any,
headers?: HttpHeaders,
observe: 'response',
observe: 'response', params?: HttpParams,
responseType: 'arraybuffer', withCredentials?: boolean,
}): Observable<HttpResponse<ArrayBuffer>>;
request(method: string, url: string, options: {
body?: any,
headers?: HttpHeaders,
observe: 'response',
observe: 'response', params?: HttpParams,
responseType: 'blob', withCredentials?: boolean,
}): Observable<HttpResponse<Blob>>;
request(method: string, url: string, options: {
body?: any,
headers?: HttpHeaders,
observe: 'response',
observe: 'response', params?: HttpParams,
responseType: 'text', withCredentials?: boolean,
}): Observable<HttpResponse<string>>;
request<R>(method: string, url: string, options: {
body?: any,
headers?: HttpHeaders,
observe: 'response', responseType?: 'json', withCredentials?: boolean,
observe: 'response', params?: HttpParams, responseType?: 'json', withCredentials?: boolean,
}): Observable<HttpResponse<R>>;
request(method: string, url: string, options?: {
body?: any,
headers?: HttpHeaders,
observe?: 'body',
params?: HttpParams,
responseType?: 'json',
withCredentials?: boolean,
}): Observable<Object>;
@ -130,12 +138,14 @@ export class HttpClient {
body?: any,
headers?: HttpHeaders,
observe?: 'body',
params?: HttpParams,
responseType?: 'json',
withCredentials?: boolean,
}): Observable<R>;
request(method: string, url: string, options?: {
body?: any,
headers?: HttpHeaders,
params?: HttpParams,
observe?: HttpObserve,
responseType?: 'arraybuffer'|'blob'|'json'|'text',
withCredentials?: boolean,
@ -175,6 +185,7 @@ export class HttpClient {
body?: any,
headers?: HttpHeaders,
observe?: HttpObserve,
params?: HttpParams,
responseType?: 'arraybuffer'|'blob'|'json'|'text',
withCredentials?: boolean,
} = {}): Observable<any> {
@ -190,6 +201,7 @@ export class HttpClient {
// provided.
req = new HttpRequest(first, url !, options.body || null, {
headers: options.headers,
params: options.params,
// By default, JSON is assumed to be returned for all calls.
responseType: options.responseType || 'json',
withCredentials: options.withCredentials,
@ -266,73 +278,78 @@ export class HttpClient {
delete (url: string, options: {
headers?: HttpHeaders,
observe?: 'body',
params?: HttpParams,
responseType: 'arraybuffer', withCredentials?: boolean,
}): Observable<ArrayBuffer>;
delete (url: string, options: {
headers?: HttpHeaders,
observe?: 'body',
params?: HttpParams,
responseType: 'blob', withCredentials?: boolean,
}): Observable<Blob>;
delete (url: string, options: {
headers?: HttpHeaders,
observe?: 'body',
params?: HttpParams,
responseType: 'text', withCredentials?: boolean,
}): Observable<string>;
delete (url: string, options: {
headers?: HttpHeaders,
observe: 'events',
observe: 'events', params?: HttpParams,
responseType: 'arraybuffer', withCredentials?: boolean,
}): Observable<HttpEvent<ArrayBuffer>>;
delete (url: string, options: {
headers?: HttpHeaders,
observe: 'events',
observe: 'events', params?: HttpParams,
responseType: 'blob', withCredentials?: boolean,
}): Observable<HttpEvent<Blob>>;
delete (url: string, options: {
headers?: HttpHeaders,
observe: 'events',
observe: 'events', params?: HttpParams,
responseType: 'text', withCredentials?: boolean,
}): Observable<HttpEvent<string>>;
delete (url: string, options: {
headers?: HttpHeaders,
observe: 'events', responseType?: 'json', withCredentials?: boolean,
observe: 'events', params?: HttpParams, responseType?: 'json', withCredentials?: boolean,
}): Observable<HttpEvent<Object>>;
delete<T>(url: string, options: {
headers?: HttpHeaders,
observe: 'events', responseType?: 'json', withCredentials?: boolean,
observe: 'events', params?: HttpParams, responseType?: 'json', withCredentials?: boolean,
}): Observable<HttpEvent<T>>;
delete (url: string, options: {
headers?: HttpHeaders,
observe: 'response',
observe: 'response', params?: HttpParams,
responseType: 'arraybuffer', withCredentials?: boolean,
}): Observable<HttpResponse<ArrayBuffer>>;
delete (url: string, options: {
headers?: HttpHeaders,
observe: 'response',
observe: 'response', params?: HttpParams,
responseType: 'blob', withCredentials?: boolean,
}): Observable<HttpResponse<Blob>>;
delete (url: string, options: {
headers?: HttpHeaders,
observe: 'response',
observe: 'response', params?: HttpParams,
responseType: 'text', withCredentials?: boolean,
}): Observable<HttpResponse<string>>;
delete (url: string, options: {
headers?: HttpHeaders,
observe: 'response', responseType?: 'json', withCredentials?: boolean,
observe: 'response', params?: HttpParams, responseType?: 'json', withCredentials?: boolean,
}): Observable<HttpResponse<Object>>;
delete<T>(url: string, options: {
headers?: HttpHeaders,
observe: 'response', responseType?: 'json', withCredentials?: boolean,
observe: 'response', params?: HttpParams, responseType?: 'json', withCredentials?: boolean,
}): Observable<HttpResponse<T>>;
delete (url: string, options?: {
headers?: HttpHeaders,
observe?: 'body',
params?: HttpParams,
responseType?: 'json',
withCredentials?: boolean,
}): Observable<Object>;
delete<T>(url: string, options?: {
headers?: HttpHeaders,
observe?: 'body',
params?: HttpParams,
responseType?: 'json',
withCredentials?: boolean,
}): Observable<T>;
@ -344,6 +361,7 @@ export class HttpClient {
delete (url: string, options: {
headers?: HttpHeaders,
observe?: HttpObserve,
params?: HttpParams,
responseType?: 'arraybuffer'|'blob'|'json'|'text',
withCredentials?: boolean,
} = {}): Observable<any> {
@ -353,73 +371,78 @@ export class HttpClient {
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',
observe: 'events', params?: HttpParams,
responseType: 'arraybuffer', withCredentials?: boolean,
}): Observable<HttpEvent<ArrayBuffer>>;
get(url: string, options: {
headers?: HttpHeaders,
observe: 'events',
observe: 'events', params?: HttpParams,
responseType: 'blob', withCredentials?: boolean,
}): Observable<HttpEvent<Blob>>;
get(url: string, options: {
headers?: HttpHeaders,
observe: 'events',
observe: 'events', params?: HttpParams,
responseType: 'text', withCredentials?: boolean,
}): Observable<HttpEvent<string>>;
get(url: string, options: {
headers?: HttpHeaders,
observe: 'events', responseType?: 'json', withCredentials?: boolean,
observe: 'events', params?: HttpParams, responseType?: 'json', withCredentials?: boolean,
}): Observable<HttpEvent<Object>>;
get<T>(url: string, options: {
headers?: HttpHeaders,
observe: 'events', responseType?: 'json', withCredentials?: boolean,
observe: 'events', params?: HttpParams, responseType?: 'json', withCredentials?: boolean,
}): Observable<HttpEvent<T>>;
get(url: string, options: {
headers?: HttpHeaders,
observe: 'response',
observe: 'response', params?: HttpParams,
responseType: 'arraybuffer', withCredentials?: boolean,
}): Observable<HttpResponse<ArrayBuffer>>;
get(url: string, options: {
headers?: HttpHeaders,
observe: 'response',
observe: 'response', params?: HttpParams,
responseType: 'blob', withCredentials?: boolean,
}): Observable<HttpResponse<Blob>>;
get(url: string, options: {
headers?: HttpHeaders,
observe: 'response',
observe: 'response', params?: HttpParams,
responseType: 'text', withCredentials?: boolean,
}): Observable<HttpResponse<string>>;
get(url: string, options: {
headers?: HttpHeaders,
observe: 'response', responseType?: 'json', withCredentials?: boolean,
observe: 'response', params?: HttpParams, responseType?: 'json', withCredentials?: boolean,
}): Observable<HttpResponse<Object>>;
get<T>(url: string, options: {
headers?: HttpHeaders,
observe: 'response', responseType?: 'json', withCredentials?: boolean,
observe: 'response', params?: HttpParams, responseType?: 'json', withCredentials?: boolean,
}): Observable<HttpResponse<T>>;
get(url: string, options?: {
headers?: HttpHeaders,
observe?: 'body',
params?: HttpParams,
responseType?: 'json',
withCredentials?: boolean,
}): Observable<Object>;
get<T>(url: string, options?: {
headers?: HttpHeaders,
observe?: 'body',
params?: HttpParams,
responseType?: 'json',
withCredentials?: boolean,
}): Observable<T>;
@ -431,6 +454,7 @@ export class HttpClient {
get(url: string, options: {
headers?: HttpHeaders,
observe?: HttpObserve,
params?: HttpParams,
responseType?: 'arraybuffer'|'blob'|'json'|'text',
withCredentials?: boolean,
} = {}): Observable<any> {
@ -440,73 +464,78 @@ export class HttpClient {
head(url: string, options: {
headers?: HttpHeaders,
observe?: 'body',
params?: HttpParams,
responseType: 'arraybuffer', withCredentials?: boolean,
}): Observable<ArrayBuffer>;
head(url: string, options: {
headers?: HttpHeaders,
observe?: 'body',
params?: HttpParams,
responseType: 'blob', withCredentials?: boolean,
}): Observable<Blob>;
head(url: string, options: {
headers?: HttpHeaders,
observe?: 'body',
params?: HttpParams,
responseType: 'text', withCredentials?: boolean,
}): Observable<string>;
head(url: string, options: {
headers?: HttpHeaders,
observe: 'events',
observe: 'events', params?: HttpParams,
responseType: 'arraybuffer', withCredentials?: boolean,
}): Observable<HttpEvent<ArrayBuffer>>;
head(url: string, options: {
headers?: HttpHeaders,
observe: 'events',
observe: 'events', params?: HttpParams,
responseType: 'blob', withCredentials?: boolean,
}): Observable<HttpEvent<Blob>>;
head(url: string, options: {
headers?: HttpHeaders,
observe: 'events',
observe: 'events', params?: HttpParams,
responseType: 'text', withCredentials?: boolean,
}): Observable<HttpEvent<string>>;
head(url: string, options: {
headers?: HttpHeaders,
observe: 'events', responseType?: 'json', withCredentials?: boolean,
observe: 'events', params?: HttpParams, responseType?: 'json', withCredentials?: boolean,
}): Observable<HttpEvent<Object>>;
head<T>(url: string, options: {
headers?: HttpHeaders,
observe: 'events', responseType?: 'json', withCredentials?: boolean,
observe: 'events', params?: HttpParams, responseType?: 'json', withCredentials?: boolean,
}): Observable<HttpEvent<T>>;
head(url: string, options: {
headers?: HttpHeaders,
observe: 'response',
observe: 'response', params?: HttpParams,
responseType: 'arraybuffer', withCredentials?: boolean,
}): Observable<HttpResponse<ArrayBuffer>>;
head(url: string, options: {
headers?: HttpHeaders,
observe: 'response',
observe: 'response', params?: HttpParams,
responseType: 'blob', withCredentials?: boolean,
}): Observable<HttpResponse<Blob>>;
head(url: string, options: {
headers?: HttpHeaders,
observe: 'response',
observe: 'response', params?: HttpParams,
responseType: 'text', withCredentials?: boolean,
}): Observable<HttpResponse<string>>;
head(url: string, options: {
headers?: HttpHeaders,
observe: 'response', responseType?: 'json', withCredentials?: boolean,
observe: 'response', params?: HttpParams, responseType?: 'json', withCredentials?: boolean,
}): Observable<HttpResponse<Object>>;
head<T>(url: string, options: {
headers?: HttpHeaders,
observe: 'response', responseType?: 'json', withCredentials?: boolean,
observe: 'response', params?: HttpParams, responseType?: 'json', withCredentials?: boolean,
}): Observable<HttpResponse<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?: 'body',
params?: HttpParams,
responseType?: 'json',
withCredentials?: boolean,
}): Observable<T>;
@ -518,14 +547,15 @@ export class HttpClient {
head(url: string, options: {
headers?: HttpHeaders,
observe?: HttpObserve,
params?: HttpParams,
responseType?: 'arraybuffer'|'blob'|'json'|'text',
withCredentials?: boolean,
} = {}): Observable<any> {
return this.request<any>('HEAD', url, options as any);
}
jsonp(url: string): Observable<any>;
jsonp<T>(url: string): Observable<T>;
jsonp(url: string, callbackParam: string): Observable<any>;
jsonp<T>(url: string, callbackParam: string): Observable<T>;
/**
* Constructs an `Observable` which, when subscribed, will cause a request
* with the special method `JSONP` to be dispatched via the interceptor pipeline.
@ -534,8 +564,9 @@ export class HttpClient {
* If no such interceptor is reached, then the `JSONP` request will likely be
* rejected by the configured backend.
*/
jsonp<T>(url: string): Observable<T> {
jsonp<T>(url: string, callbackParam: string): Observable<T> {
return this.request<any>('JSONP', url, {
params: new HttpParams().append(callbackParam, 'JSONP_CALLBACK'),
observe: 'body',
responseType: 'json',
});
@ -544,73 +575,78 @@ export class HttpClient {
options(url: string, options: {
headers?: HttpHeaders,
observe?: 'body',
params?: HttpParams,
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',
params?: HttpParams,
responseType: 'text', withCredentials?: boolean,
}): Observable<string>;
options(url: string, options: {
headers?: HttpHeaders,
observe: 'events',
observe: 'events', params?: HttpParams,
responseType: 'arraybuffer', withCredentials?: boolean,
}): Observable<HttpEvent<ArrayBuffer>>;
options(url: string, options: {
headers?: HttpHeaders,
observe: 'events',
observe: 'events', params?: HttpParams,
responseType: 'blob', withCredentials?: boolean,
}): Observable<HttpEvent<Blob>>;
options(url: string, options: {
headers?: HttpHeaders,
observe: 'events',
observe: 'events', params?: HttpParams,
responseType: 'text', withCredentials?: boolean,
}): Observable<HttpEvent<string>>;
options(url: string, options: {
headers?: HttpHeaders,
observe: 'events', responseType?: 'json', withCredentials?: boolean,
observe: 'events', params?: HttpParams, responseType?: 'json', withCredentials?: boolean,
}): Observable<HttpEvent<Object>>;
options<T>(url: string, options: {
headers?: HttpHeaders,
observe: 'events', responseType?: 'json', withCredentials?: boolean,
observe: 'events', params?: HttpParams, responseType?: 'json', withCredentials?: boolean,
}): Observable<HttpEvent<T>>;
options(url: string, options: {
headers?: HttpHeaders,
observe: 'response',
observe: 'response', params?: HttpParams,
responseType: 'arraybuffer', withCredentials?: boolean,
}): Observable<HttpResponse<ArrayBuffer>>;
options(url: string, options: {
headers?: HttpHeaders,
observe: 'response',
observe: 'response', params?: HttpParams,
responseType: 'blob', withCredentials?: boolean,
}): Observable<HttpResponse<Blob>>;
options(url: string, options: {
headers?: HttpHeaders,
observe: 'response',
observe: 'response', params?: HttpParams,
responseType: 'text', withCredentials?: boolean,
}): Observable<HttpResponse<string>>;
options(url: string, options: {
headers?: HttpHeaders,
observe: 'response', responseType?: 'json', withCredentials?: boolean,
observe: 'response', params?: HttpParams, responseType?: 'json', withCredentials?: boolean,
}): Observable<HttpResponse<Object>>;
options<T>(url: string, options: {
headers?: HttpHeaders,
observe: 'response', responseType?: 'json', withCredentials?: boolean,
observe: 'response', params?: HttpParams, responseType?: 'json', withCredentials?: boolean,
}): Observable<HttpResponse<T>>;
options(url: string, options?: {
headers?: HttpHeaders,
observe?: 'body',
params?: HttpParams,
responseType?: 'json',
withCredentials?: boolean,
}): Observable<Object>;
options<T>(url: string, options?: {
headers?: HttpHeaders,
observe?: 'body',
params?: HttpParams,
responseType?: 'json',
withCredentials?: boolean,
}): Observable<T>;
@ -622,6 +658,7 @@ export class HttpClient {
options(url: string, options: {
headers?: HttpHeaders,
observe?: HttpObserve,
params?: HttpParams,
responseType?: 'arraybuffer'|'blob'|'json'|'text',
withCredentials?: boolean,
} = {}): Observable<any> {
@ -631,73 +668,78 @@ export class HttpClient {
patch(url: string, body: any|null, options: {
headers?: HttpHeaders,
observe?: 'body',
params?: HttpParams,
responseType: 'arraybuffer', withCredentials?: boolean,
}): Observable<ArrayBuffer>;
patch(url: string, body: any|null, options: {
headers?: HttpHeaders,
observe?: 'body',
params?: HttpParams,
responseType: 'blob', withCredentials?: boolean,
}): Observable<Blob>;
patch(url: string, body: any|null, options: {
headers?: HttpHeaders,
observe?: 'body',
params?: HttpParams,
responseType: 'text', withCredentials?: boolean,
}): Observable<string>;
patch(url: string, body: any|null, options: {
headers?: HttpHeaders,
observe: 'events',
observe: 'events', params?: HttpParams,
responseType: 'arraybuffer', withCredentials?: boolean,
}): Observable<HttpEvent<ArrayBuffer>>;
patch(url: string, body: any|null, options: {
headers?: HttpHeaders,
observe: 'events',
observe: 'events', params?: HttpParams,
responseType: 'blob', withCredentials?: boolean,
}): Observable<HttpEvent<Blob>>;
patch(url: string, body: any|null, options: {
headers?: HttpHeaders,
observe: 'events',
observe: 'events', params?: HttpParams,
responseType: 'text', withCredentials?: boolean,
}): Observable<HttpEvent<string>>;
patch(url: string, body: any|null, options: {
headers?: HttpHeaders,
observe: 'events', responseType?: 'json', withCredentials?: boolean,
observe: 'events', params?: HttpParams, responseType?: 'json', withCredentials?: boolean,
}): Observable<HttpEvent<Object>>;
patch<T>(url: string, body: any|null, options: {
headers?: HttpHeaders,
observe: 'events', responseType?: 'json', withCredentials?: boolean,
observe: 'events', params?: HttpParams, responseType?: 'json', withCredentials?: boolean,
}): Observable<HttpEvent<T>>;
patch(url: string, body: any|null, options: {
headers?: HttpHeaders,
observe: 'response',
observe: 'response', params?: HttpParams,
responseType: 'arraybuffer', withCredentials?: boolean,
}): Observable<HttpResponse<ArrayBuffer>>;
patch(url: string, body: any|null, options: {
headers?: HttpHeaders,
observe: 'response',
observe: 'response', params?: HttpParams,
responseType: 'blob', withCredentials?: boolean,
}): Observable<HttpResponse<Blob>>;
patch(url: string, body: any|null, options: {
headers?: HttpHeaders,
observe: 'response',
observe: 'response', params?: HttpParams,
responseType: 'text', withCredentials?: boolean,
}): Observable<HttpResponse<string>>;
patch(url: string, body: any|null, options: {
headers?: HttpHeaders,
observe: 'response', responseType?: 'json', withCredentials?: boolean,
observe: 'response', params?: HttpParams, responseType?: 'json', withCredentials?: boolean,
}): Observable<HttpResponse<Object>>;
patch<T>(url: string, body: any|null, options: {
headers?: HttpHeaders,
observe: 'response', responseType?: 'json', withCredentials?: boolean,
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',
params?: HttpParams,
responseType?: 'json',
withCredentials?: boolean,
}): Observable<T>;
@ -709,6 +751,7 @@ export class HttpClient {
patch(url: string, body: any|null, options: {
headers?: HttpHeaders,
observe?: HttpObserve,
params?: HttpParams,
responseType?: 'arraybuffer'|'blob'|'json'|'text',
withCredentials?: boolean,
} = {}): Observable<any> {
@ -718,73 +761,78 @@ export class HttpClient {
post(url: string, body: any|null, options: {
headers?: HttpHeaders,
observe?: 'body',
params?: HttpParams,
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',
params?: HttpParams,
responseType: 'text', withCredentials?: boolean,
}): Observable<string>;
post(url: string, body: any|null, options: {
headers?: HttpHeaders,
observe: 'events',
observe: 'events', params?: HttpParams,
responseType: 'arraybuffer', withCredentials?: boolean,
}): Observable<HttpEvent<ArrayBuffer>>;
post(url: string, body: any|null, options: {
headers?: HttpHeaders,
observe: 'events',
observe: 'events', params?: HttpParams,
responseType: 'blob', withCredentials?: boolean,
}): Observable<HttpEvent<Blob>>;
post(url: string, body: any|null, options: {
headers?: HttpHeaders,
observe: 'events',
observe: 'events', params?: HttpParams,
responseType: 'text', withCredentials?: boolean,
}): Observable<HttpEvent<string>>;
post(url: string, body: any|null, options: {
headers?: HttpHeaders,
observe: 'events', responseType?: 'json', withCredentials?: boolean,
observe: 'events', params?: HttpParams, responseType?: 'json', withCredentials?: boolean,
}): Observable<HttpEvent<Object>>;
post<T>(url: string, body: any|null, options: {
headers?: HttpHeaders,
observe: 'events', responseType?: 'json', withCredentials?: boolean,
observe: 'events', params?: HttpParams, responseType?: 'json', withCredentials?: boolean,
}): Observable<HttpEvent<T>>;
post(url: string, body: any|null, options: {
headers?: HttpHeaders,
observe: 'response',
observe: 'response', params?: HttpParams,
responseType: 'arraybuffer', withCredentials?: boolean,
}): Observable<HttpResponse<ArrayBuffer>>;
post(url: string, body: any|null, options: {
headers?: HttpHeaders,
observe: 'response',
observe: 'response', params?: HttpParams,
responseType: 'blob', withCredentials?: boolean,
}): Observable<HttpResponse<Blob>>;
post(url: string, body: any|null, options: {
headers?: HttpHeaders,
observe: 'response',
observe: 'response', params?: HttpParams,
responseType: 'text', withCredentials?: boolean,
}): Observable<HttpResponse<string>>;
post(url: string, body: any|null, options: {
headers?: HttpHeaders,
observe: 'response', responseType?: 'json', withCredentials?: boolean,
observe: 'response', params?: HttpParams, responseType?: 'json', withCredentials?: boolean,
}): Observable<HttpResponse<Object>>;
post<T>(url: string, body: any|null, options: {
headers?: HttpHeaders,
observe: 'response', responseType?: 'json', withCredentials?: boolean,
observe: 'response', params?: HttpParams, 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>;
@ -796,6 +844,7 @@ export class HttpClient {
post(url: string, body: any|null, options: {
headers?: HttpHeaders,
observe?: HttpObserve,
params?: HttpParams,
responseType?: 'arraybuffer'|'blob'|'json'|'text',
withCredentials?: boolean,
} = {}): Observable<any> {
@ -805,36 +854,39 @@ export class HttpClient {
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?: 'body',
params?: HttpParams,
responseType: 'blob', withCredentials?: boolean,
}): Observable<Blob>;
put(url: string, body: any|null, options: {
headers?: HttpHeaders,
observe?: 'body',
params?: HttpParams,
responseType: 'text', withCredentials?: boolean,
}): Observable<string>;
put(url: string, body: any|null, options: {
headers?: HttpHeaders,
observe: 'events',
observe: 'events', params?: HttpParams,
responseType: 'arraybuffer', withCredentials?: boolean,
}): Observable<HttpEvent<ArrayBuffer>>;
put(url: string, body: any|null, options: {
headers?: HttpHeaders,
observe: 'events',
observe: 'events', params?: HttpParams,
responseType: 'blob', withCredentials?: boolean,
}): Observable<HttpEvent<Blob>>;
put(url: string, body: any|null, options: {
headers?: HttpHeaders,
observe: 'events',
observe: 'events', params?: HttpParams,
responseType: 'text', withCredentials?: boolean,
}): Observable<HttpEvent<string>>;
put(url: string, body: any|null, options: {
headers?: HttpHeaders,
observe: 'events', responseType?: 'json', withCredentials?: boolean,
observe: 'events', params?: HttpParams, responseType?: 'json', withCredentials?: boolean,
}): Observable<HttpEvent<Object>>;
put<T>(url: string, body: any|null, options: {
headers?: HttpHeaders,
@ -842,36 +894,38 @@ export class HttpClient {
}): Observable<HttpEvent<T>>;
put(url: string, body: any|null, options: {
headers?: HttpHeaders,
observe: 'response',
observe: 'response', params?: HttpParams,
responseType: 'arraybuffer', withCredentials?: boolean,
}): Observable<HttpResponse<ArrayBuffer>>;
put(url: string, body: any|null, options: {
headers?: HttpHeaders,
observe: 'response',
observe: 'response', params?: HttpParams,
responseType: 'blob', withCredentials?: boolean,
}): Observable<HttpResponse<Blob>>;
put(url: string, body: any|null, options: {
headers?: HttpHeaders,
observe: 'response',
observe: 'response', params?: HttpParams,
responseType: 'text', withCredentials?: boolean,
}): Observable<HttpResponse<string>>;
put(url: string, body: any|null, options: {
headers?: HttpHeaders,
observe: 'response', responseType?: 'json', withCredentials?: boolean,
observe: 'response', params?: HttpParams, responseType?: 'json', withCredentials?: boolean,
}): Observable<HttpResponse<Object>>;
put<T>(url: string, body: any|null, options: {
headers?: HttpHeaders,
observe: 'response', responseType?: 'json', withCredentials?: boolean,
observe: 'response', params?: HttpParams, responseType?: 'json', withCredentials?: boolean,
}): Observable<HttpResponse<T>>;
put(url: string, body: any|null, options?: {
headers?: HttpHeaders,
observe?: 'body',
params?: HttpParams,
responseType?: 'json',
withCredentials?: boolean,
}): Observable<Object>;
put<T>(url: string, body: any|null, options?: {
headers?: HttpHeaders,
observe?: 'body',
params?: HttpParams,
responseType?: 'json',
withCredentials?: boolean,
}): Observable<T>;
@ -883,6 +937,7 @@ export class HttpClient {
put(url: string, body: any|null, options: {
headers?: HttpHeaders,
observe?: HttpObserve,
params?: HttpParams,
responseType?: 'arraybuffer'|'blob'|'json'|'text',
withCredentials?: boolean,
} = {}): Observable<any> {