Alex Rickabaugh 37797e2b4e feat(common): new HttpClient API
HttpClient is an evolution of the existing Angular HTTP API, which exists
alongside of it in a separate package, @angular/common/http. This structure
ensures that existing codebases can slowly migrate to the new API.

The new API improves significantly on the ergonomics and features of the legacy
API. A partial list of new features includes:

* Typed, synchronous response body access, including support for JSON body types
* JSON is an assumed default and no longer needs to be explicitly parsed
* Interceptors allow middleware logic to be inserted into the pipeline
* Immutable request/response objects
* Progress events for both request upload and response download
* Post-request verification & flush based testing framework
2017-07-07 12:09:32 -07:00

48 lines
1.7 KiB
TypeScript

/** @experimental */
export declare class HttpClientTestingModule {
}
/** @experimental */
export declare abstract class HttpTestingController {
abstract expectNone(url: string): void;
abstract expectNone(params: RequestMatch): void;
abstract expectNone(matchFn: ((req: HttpRequest<any>) => boolean)): void;
abstract expectNone(match: string | RequestMatch | ((req: HttpRequest<any>) => boolean)): void;
abstract expectOne(url: string): TestRequest;
abstract expectOne(params: RequestMatch): TestRequest;
abstract expectOne(matchFn: ((req: HttpRequest<any>) => boolean)): TestRequest;
abstract expectOne(match: string | RequestMatch | ((req: HttpRequest<any>) => boolean)): TestRequest;
abstract match(match: string | RequestMatch | ((req: HttpRequest<any>) => boolean)): TestRequest[];
abstract verify(opts?: {
ignoreCancelled?: boolean;
}): void;
}
/** @experimental */
export interface RequestMatch {
method?: string;
url?: string;
}
/** @experimental */
export declare class TestRequest {
readonly cancelled: boolean;
request: HttpRequest<any>;
constructor(request: HttpRequest<any>, observer: Observer<HttpEvent<any>>);
error(error: ErrorEvent, opts?: {
headers?: HttpHeaders | {
[name: string]: string | string[];
};
status?: number;
statusText?: string;
}): void;
event(event: HttpEvent<any>): void;
flush(body: ArrayBuffer | Blob | string | number | Object | (string | number | Object | null)[] | null, opts?: {
headers?: HttpHeaders | {
[name: string]: string | string[];
};
status?: number;
statusText?: string;
}): void;
}