HttpTestingController
Controller to be injected into tests, that allows for mocking and flushing of requests.
abstract class HttpTestingController {
abstract match(match: string | RequestMatch | ((req: HttpRequest<any>) => boolean)): TestRequest[]
abstract expectOne(url: string, description?: string): TestRequest
abstract expectNone(url: string, description?: string): void
abstract verify(opts?: { ignoreCancelled?: boolean; }): void
}
方法
Search for requests that match the given parameter, without any expectations. | |||
参数
返回值 |
Expect that a single request has been made which matches the given URL, and return its mock. | ||||||||||||||||||||||||
3 个重载形式...显示所有 隐藏所有 expand_more
参数
返回值Overload #1Expect that a single request has been made which matches the given parameters, and return its mock.
参数
返回值Overload #2Expect that a single request has been made which matches the given predicate function, and return its mock.
参数
返回值Overload #3Expect 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. |
Expect that no requests have been made which match the given URL. | ||||||||||||||||||||||||
3 个重载形式...显示所有 隐藏所有 expand_more
参数
返回值
Overload #1Expect that no requests have been made which match the given parameters.
参数
返回值
Overload #2Expect that no requests have been made which match the given predicate function.
参数
返回值
Overload #3Expect 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. |
Verify that no unmatched requests are outstanding. |
If any requests are outstanding, fail with an error message indicating which requests were not handled. If |