docs(http): fixed example unit test for error catching (#25306)

The example unit test should test the service when the backend
application is not available, by providing a mock error response.
Although, the test will
fail as the mock response from the server is valid (it does not simulate
a
error response, but valid response with an error status 404).
This merge request fix this issue by replacing MockResponse with
MockError

This PR resolves 19499 issue

PR Close #25306
This commit is contained in:
Bartosz Wyporkiewicz 2018-08-04 17:05:46 +01:00 committed by Kara Erickson
parent 4eb8ac6de9
commit 637ae135c5
1 changed files with 1 additions and 1 deletions

View File

@ -176,7 +176,7 @@ export class MockConnection implements Connection {
* this.heroService.getHeroes() * this.heroService.getHeroes()
* .then((heroes: String[]) => result = heroes) * .then((heroes: String[]) => result = heroes)
* .catch((error: any) => catchedError = error); * .catch((error: any) => catchedError = error);
* this.lastConnection.mockRespond(new Response(new ResponseOptions({ * this.lastConnection.mockError(new Response(new ResponseOptions({
* status: 404, * status: 404,
* statusText: 'URL not Found', * statusText: 'URL not Found',
* }))); * })));