From cc6c4346c220e3f3089ee16cdca3df56e664a884 Mon Sep 17 00:00:00 2001 From: Bennett Hardwick Date: Fri, 27 Apr 2018 20:44:07 +1000 Subject: [PATCH] docs(aio): update docs error in guide/http (#23567) Updates documentation to include examples for both req.flush and req.error in http testing examples. PR Close #23567 --- .../examples/http/src/testing/http-client.spec.ts | 4 ++-- aio/content/guide/http.md | 10 +++++++++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/aio/content/examples/http/src/testing/http-client.spec.ts b/aio/content/examples/http/src/testing/http-client.spec.ts index 2c5b5ffd46..e98bc7562e 100644 --- a/aio/content/examples/http/src/testing/http-client.spec.ts +++ b/aio/content/examples/http/src/testing/http-client.spec.ts @@ -150,7 +150,7 @@ describe('HttpClient testing', () => { // Create mock ErrorEvent, raised when something goes wrong at the network level. // Connection timeout, DNS error, offline, etc - const errorEvent = new ErrorEvent('so sad', { + const mockError = new ErrorEvent('Network error', { message: emsg, // #enddocregion network-error // The rest of this is optional and not used. @@ -162,7 +162,7 @@ describe('HttpClient testing', () => { }); // Respond with mock error - req.error(errorEvent); + req.error(mockError); }); // #enddocregion network-error diff --git a/aio/content/guide/http.md b/aio/content/guide/http.md index 502d914a6b..10dd3b6d43 100644 --- a/aio/content/guide/http.md +++ b/aio/content/guide/http.md @@ -1030,10 +1030,18 @@ you are responsible for flushing and verifying them. You should test the app's defenses against HTTP requests that fail. -Call `request.error()` with an `ErrorEvent` instead of `request.flush()`, as in this example. +Call `request.flush()` with an error message, as seen in the following example. + +Alternatively, you can call `request.error()` with an `ErrorEvent`. + + + \ No newline at end of file