refactor(http): inline HttpObserve (#18417)

Inline `HttpObserve` for better type safety.

Fix #18146

PR Close #18417
This commit is contained in:
Fabian Wiles 2017-07-31 18:40:01 +12:00 committed by Jessica Janiuk
parent b40aa0a5d3
commit 7a5bc95614
2 changed files with 11 additions and 13 deletions

View File

@ -1472,7 +1472,7 @@ export declare class HttpClient {
params?: HttpParams | {
[param: string]: string | string[];
};
observe?: HttpObserve;
observe?: 'body' | 'events' | 'response';
reportProgress?: boolean;
responseType?: 'arraybuffer' | 'blob' | 'json' | 'text';
withCredentials?: boolean;

View File

@ -30,7 +30,7 @@ import {HttpEvent, HttpResponse} from './response';
function addBody<T>(
options: {
headers?: HttpHeaders|{[header: string]: string | string[]},
observe?: HttpObserve,
observe?: 'body'|'events'|'response',
params?: HttpParams|{[param: string]: string | string[]},
reportProgress?: boolean,
responseType?: 'arraybuffer'|'blob'|'json'|'text',
@ -48,8 +48,6 @@ function addBody<T>(
};
}
export type HttpObserve = 'body'|'events'|'response';
/**
* Performs HTTP requests.
* This service is available as an injectable class, with methods to perform HTTP requests.
@ -408,7 +406,7 @@ export class HttpClient {
body?: any,
headers?: HttpHeaders|{[header: string]: string | string[]},
params?: HttpParams|{[param: string]: string | string[]},
observe?: HttpObserve,
observe?: 'body'|'events'|'response',
reportProgress?: boolean,
responseType?: 'arraybuffer'|'blob'|'json'|'text',
withCredentials?: boolean,
@ -443,7 +441,7 @@ export class HttpClient {
request(first: string|HttpRequest<any>, url?: string, options: {
body?: any,
headers?: HttpHeaders|{[header: string]: string | string[]},
observe?: HttpObserve,
observe?: 'body'|'events'|'response',
params?: HttpParams|{[param: string]: string | string[]},
reportProgress?: boolean,
responseType?: 'arraybuffer'|'blob'|'json'|'text',
@ -825,7 +823,7 @@ export class HttpClient {
*/
delete(url: string, options: {
headers?: HttpHeaders|{[header: string]: string | string[]},
observe?: HttpObserve,
observe?: 'body'|'events'|'response',
params?: HttpParams|{[param: string]: string | string[]},
reportProgress?: boolean,
responseType?: 'arraybuffer'|'blob'|'json'|'text',
@ -1100,7 +1098,7 @@ export class HttpClient {
*/
get(url: string, options: {
headers?: HttpHeaders|{[header: string]: string | string[]},
observe?: HttpObserve,
observe?: 'body'|'events'|'response',
params?: HttpParams|{[param: string]: string | string[]},
reportProgress?: boolean,
responseType?: 'arraybuffer'|'blob'|'json'|'text',
@ -1382,7 +1380,7 @@ export class HttpClient {
*/
head(url: string, options: {
headers?: HttpHeaders|{[header: string]: string | string[]},
observe?: HttpObserve,
observe?: 'body'|'events'|'response',
params?: HttpParams|{[param: string]: string | string[]},
reportProgress?: boolean,
responseType?: 'arraybuffer'|'blob'|'json'|'text',
@ -1711,7 +1709,7 @@ export class HttpClient {
*/
options(url: string, options: {
headers?: HttpHeaders|{[header: string]: string | string[]},
observe?: HttpObserve,
observe?: 'body'|'events'|'response',
params?: HttpParams|{[param: string]: string | string[]},
reportProgress?: boolean,
responseType?: 'arraybuffer'|'blob'|'json'|'text',
@ -2005,7 +2003,7 @@ export class HttpClient {
*/
patch(url: string, body: any|null, options: {
headers?: HttpHeaders|{[header: string]: string | string[]},
observe?: HttpObserve,
observe?: 'body'|'events'|'response',
params?: HttpParams|{[param: string]: string | string[]},
reportProgress?: boolean,
responseType?: 'arraybuffer'|'blob'|'json'|'text',
@ -2299,7 +2297,7 @@ export class HttpClient {
*/
post(url: string, body: any|null, options: {
headers?: HttpHeaders|{[header: string]: string | string[]},
observe?: HttpObserve,
observe?: 'body'|'events'|'response',
params?: HttpParams|{[param: string]: string | string[]},
reportProgress?: boolean,
responseType?: 'arraybuffer'|'blob'|'json'|'text',
@ -2592,7 +2590,7 @@ export class HttpClient {
*/
put(url: string, body: any|null, options: {
headers?: HttpHeaders|{[header: string]: string | string[]},
observe?: HttpObserve,
observe?: 'body'|'events'|'response',
params?: HttpParams|{[param: string]: string | string[]},
reportProgress?: boolean,
responseType?: 'arraybuffer'|'blob'|'json'|'text',