refactor(http): inline HttpObserve (#18417)
Inline `HttpObserve` for better type safety. Fix #18146 PR Close #18417
This commit is contained in:
parent
b40aa0a5d3
commit
7a5bc95614
2
goldens/public-api/common/http/http.d.ts
vendored
2
goldens/public-api/common/http/http.d.ts
vendored
@ -1472,7 +1472,7 @@ export declare class HttpClient {
|
|||||||
params?: HttpParams | {
|
params?: HttpParams | {
|
||||||
[param: string]: string | string[];
|
[param: string]: string | string[];
|
||||||
};
|
};
|
||||||
observe?: HttpObserve;
|
observe?: 'body' | 'events' | 'response';
|
||||||
reportProgress?: boolean;
|
reportProgress?: boolean;
|
||||||
responseType?: 'arraybuffer' | 'blob' | 'json' | 'text';
|
responseType?: 'arraybuffer' | 'blob' | 'json' | 'text';
|
||||||
withCredentials?: boolean;
|
withCredentials?: boolean;
|
||||||
|
@ -30,7 +30,7 @@ import {HttpEvent, HttpResponse} from './response';
|
|||||||
function addBody<T>(
|
function addBody<T>(
|
||||||
options: {
|
options: {
|
||||||
headers?: HttpHeaders|{[header: string]: string | string[]},
|
headers?: HttpHeaders|{[header: string]: string | string[]},
|
||||||
observe?: HttpObserve,
|
observe?: 'body'|'events'|'response',
|
||||||
params?: HttpParams|{[param: string]: string | string[]},
|
params?: HttpParams|{[param: string]: string | string[]},
|
||||||
reportProgress?: boolean,
|
reportProgress?: boolean,
|
||||||
responseType?: 'arraybuffer'|'blob'|'json'|'text',
|
responseType?: 'arraybuffer'|'blob'|'json'|'text',
|
||||||
@ -48,8 +48,6 @@ function addBody<T>(
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export type HttpObserve = 'body'|'events'|'response';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Performs HTTP requests.
|
* Performs HTTP requests.
|
||||||
* This service is available as an injectable class, with methods to perform 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,
|
body?: any,
|
||||||
headers?: HttpHeaders|{[header: string]: string | string[]},
|
headers?: HttpHeaders|{[header: string]: string | string[]},
|
||||||
params?: HttpParams|{[param: string]: string | string[]},
|
params?: HttpParams|{[param: string]: string | string[]},
|
||||||
observe?: HttpObserve,
|
observe?: 'body'|'events'|'response',
|
||||||
reportProgress?: boolean,
|
reportProgress?: boolean,
|
||||||
responseType?: 'arraybuffer'|'blob'|'json'|'text',
|
responseType?: 'arraybuffer'|'blob'|'json'|'text',
|
||||||
withCredentials?: boolean,
|
withCredentials?: boolean,
|
||||||
@ -443,7 +441,7 @@ export class HttpClient {
|
|||||||
request(first: string|HttpRequest<any>, url?: string, options: {
|
request(first: string|HttpRequest<any>, url?: string, options: {
|
||||||
body?: any,
|
body?: any,
|
||||||
headers?: HttpHeaders|{[header: string]: string | string[]},
|
headers?: HttpHeaders|{[header: string]: string | string[]},
|
||||||
observe?: HttpObserve,
|
observe?: 'body'|'events'|'response',
|
||||||
params?: HttpParams|{[param: string]: string | string[]},
|
params?: HttpParams|{[param: string]: string | string[]},
|
||||||
reportProgress?: boolean,
|
reportProgress?: boolean,
|
||||||
responseType?: 'arraybuffer'|'blob'|'json'|'text',
|
responseType?: 'arraybuffer'|'blob'|'json'|'text',
|
||||||
@ -825,7 +823,7 @@ export class HttpClient {
|
|||||||
*/
|
*/
|
||||||
delete(url: string, options: {
|
delete(url: string, options: {
|
||||||
headers?: HttpHeaders|{[header: string]: string | string[]},
|
headers?: HttpHeaders|{[header: string]: string | string[]},
|
||||||
observe?: HttpObserve,
|
observe?: 'body'|'events'|'response',
|
||||||
params?: HttpParams|{[param: string]: string | string[]},
|
params?: HttpParams|{[param: string]: string | string[]},
|
||||||
reportProgress?: boolean,
|
reportProgress?: boolean,
|
||||||
responseType?: 'arraybuffer'|'blob'|'json'|'text',
|
responseType?: 'arraybuffer'|'blob'|'json'|'text',
|
||||||
@ -1100,7 +1098,7 @@ export class HttpClient {
|
|||||||
*/
|
*/
|
||||||
get(url: string, options: {
|
get(url: string, options: {
|
||||||
headers?: HttpHeaders|{[header: string]: string | string[]},
|
headers?: HttpHeaders|{[header: string]: string | string[]},
|
||||||
observe?: HttpObserve,
|
observe?: 'body'|'events'|'response',
|
||||||
params?: HttpParams|{[param: string]: string | string[]},
|
params?: HttpParams|{[param: string]: string | string[]},
|
||||||
reportProgress?: boolean,
|
reportProgress?: boolean,
|
||||||
responseType?: 'arraybuffer'|'blob'|'json'|'text',
|
responseType?: 'arraybuffer'|'blob'|'json'|'text',
|
||||||
@ -1382,7 +1380,7 @@ export class HttpClient {
|
|||||||
*/
|
*/
|
||||||
head(url: string, options: {
|
head(url: string, options: {
|
||||||
headers?: HttpHeaders|{[header: string]: string | string[]},
|
headers?: HttpHeaders|{[header: string]: string | string[]},
|
||||||
observe?: HttpObserve,
|
observe?: 'body'|'events'|'response',
|
||||||
params?: HttpParams|{[param: string]: string | string[]},
|
params?: HttpParams|{[param: string]: string | string[]},
|
||||||
reportProgress?: boolean,
|
reportProgress?: boolean,
|
||||||
responseType?: 'arraybuffer'|'blob'|'json'|'text',
|
responseType?: 'arraybuffer'|'blob'|'json'|'text',
|
||||||
@ -1711,7 +1709,7 @@ export class HttpClient {
|
|||||||
*/
|
*/
|
||||||
options(url: string, options: {
|
options(url: string, options: {
|
||||||
headers?: HttpHeaders|{[header: string]: string | string[]},
|
headers?: HttpHeaders|{[header: string]: string | string[]},
|
||||||
observe?: HttpObserve,
|
observe?: 'body'|'events'|'response',
|
||||||
params?: HttpParams|{[param: string]: string | string[]},
|
params?: HttpParams|{[param: string]: string | string[]},
|
||||||
reportProgress?: boolean,
|
reportProgress?: boolean,
|
||||||
responseType?: 'arraybuffer'|'blob'|'json'|'text',
|
responseType?: 'arraybuffer'|'blob'|'json'|'text',
|
||||||
@ -2005,7 +2003,7 @@ export class HttpClient {
|
|||||||
*/
|
*/
|
||||||
patch(url: string, body: any|null, options: {
|
patch(url: string, body: any|null, options: {
|
||||||
headers?: HttpHeaders|{[header: string]: string | string[]},
|
headers?: HttpHeaders|{[header: string]: string | string[]},
|
||||||
observe?: HttpObserve,
|
observe?: 'body'|'events'|'response',
|
||||||
params?: HttpParams|{[param: string]: string | string[]},
|
params?: HttpParams|{[param: string]: string | string[]},
|
||||||
reportProgress?: boolean,
|
reportProgress?: boolean,
|
||||||
responseType?: 'arraybuffer'|'blob'|'json'|'text',
|
responseType?: 'arraybuffer'|'blob'|'json'|'text',
|
||||||
@ -2299,7 +2297,7 @@ export class HttpClient {
|
|||||||
*/
|
*/
|
||||||
post(url: string, body: any|null, options: {
|
post(url: string, body: any|null, options: {
|
||||||
headers?: HttpHeaders|{[header: string]: string | string[]},
|
headers?: HttpHeaders|{[header: string]: string | string[]},
|
||||||
observe?: HttpObserve,
|
observe?: 'body'|'events'|'response',
|
||||||
params?: HttpParams|{[param: string]: string | string[]},
|
params?: HttpParams|{[param: string]: string | string[]},
|
||||||
reportProgress?: boolean,
|
reportProgress?: boolean,
|
||||||
responseType?: 'arraybuffer'|'blob'|'json'|'text',
|
responseType?: 'arraybuffer'|'blob'|'json'|'text',
|
||||||
@ -2592,7 +2590,7 @@ export class HttpClient {
|
|||||||
*/
|
*/
|
||||||
put(url: string, body: any|null, options: {
|
put(url: string, body: any|null, options: {
|
||||||
headers?: HttpHeaders|{[header: string]: string | string[]},
|
headers?: HttpHeaders|{[header: string]: string | string[]},
|
||||||
observe?: HttpObserve,
|
observe?: 'body'|'events'|'response',
|
||||||
params?: HttpParams|{[param: string]: string | string[]},
|
params?: HttpParams|{[param: string]: string | string[]},
|
||||||
reportProgress?: boolean,
|
reportProgress?: boolean,
|
||||||
responseType?: 'arraybuffer'|'blob'|'json'|'text',
|
responseType?: 'arraybuffer'|'blob'|'json'|'text',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user