(fix) MockCOnnection.mockError also accepts a Response#8961
(fix) MockCOnnection.mockError also accepts a Response#8961nexus-uw wants to merge 1 commit intoangular:masterfrom
Conversation
- updatedse check if the PR fulfills these requirements** - [x] The commit message follows our guidelines: https://github.com/angular/angular/blob/master/CONTRIBUTING.md#commit-message-format - [x] Tests for the changes have been added (for bug fixes / features) * **What kind of change does this PR introduce?** (Bug fix, feature, docs update, ...) fix + resolves a TODO in the code base * **What is the current behavior?** (You can also link to an open issue here) MockConnection.mockError only accepts an Error * **What is the new behavior (if this is a feature change)?** MockConnection.mockError now also accepts a Response object (so that people can test non-200 level status codes in their responses
6e6e04f to
26b43c6
Compare
|
already merged as c5d8e1e777e67ea3ba6ca5fb85e8d63032510dd0 |
|
We can't find c5d8e1e777e67ea3ba6ca5fb85e8d63032510dd0 in the repository - was this PR merged? We'd like this fix for our tests. |
|
@mhevery |
|
+1 for this, it currently means that the mocks don't replicate server interaction correctly |
|
Could someone please re-open a PR if this is still a pb (can not re-open this one as the beanch has been deleted). Thanks. |
|
You can actually extend Response and implement Error to get this working: |
|
@amay0048, does the above code passes compilation for you considering MockError does not have all the properties required by RequestOptions? |
|
Yes, it compiles for me. It inherits all the properties of response via the extends. |
|
@amay0048 thanks for the suggestion, works for me. From a naming standpoint, I went with ErrorResponse. Code then looks like... |
|
Just stumbled across this. The pull request should be indeed reopened. |
|
so no plan to merge this change? #13104 is also closed without merging. |
|
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |

fix + resolves a TODO in the code base
Does this PR introduce a breaking change?
MockConnection.mockError only accepts an Error
MockConnection.mockError now also accepts a Response object (so that people can test non-200 level status codes in their responses