-
Notifications
You must be signed in to change notification settings - Fork 230
fix: simulated HTTP errors now delayed as expected #182
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please add docs - otherwise lgtm
src/in-mem/delay-response.ts
Outdated
@@ -0,0 +1,30 @@ | |||
import { Observable } from 'rxjs/Observable'; | |||
|
|||
/** adds specified delay (in ms) to both next and error channels of the response observable */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please add docs you wrote for changelog also here so that nobody reading the code is wondering why we have a custom delay operator.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added reference to the CHANGELOG
6dc1617
to
d81e9c3
Compare
CHANGELOG.md
Outdated
<a id="0.5.4"></a> | ||
## 0.5.4 (2018-03-09) | ||
|
||
Simulated HTTP error responses were not delaying the prescribed time when using RxJS `delay()` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Describes the change to the implementation of simulated delay
@@ -160,7 +160,7 @@ export abstract class BackendService { | |||
*/ | |||
protected addDelay(response: Observable<any>): Observable<any> { | |||
const d = this.config.delay; | |||
return d === 0 ? response : delay.call(response, d || 500); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Replaces RxJS delay()
(incorrect for errors) with new delayRespons()
function.
Piggy backed fix to issue #180 |
Fixes bug in which a simulated HTTP error did NOT honor the prescribed latency delay.
New
makeResponseDelay()
function cures that.Added tests for this.
Library no longer uses RxJS
delay()
which may make userland tests easier because Angular TestBed "hates" RxJSdelay()
(it usesinterval()
).Also closes #180.
When this PR is merged, can publish the new version to NPM as release 0.5.4.