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

@ -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;
}