Conversation
…anceled Signed-off-by: Julien Veyssier <julien-nc@posteo.net>
|
Mind adding a simple unit test to cover this? |
Signed-off-by: Julien Veyssier <julien-nc@posteo.net>
|
@ChristophWurst Sure, is this enough? |
danxuliu
left a comment
There was a problem hiding this comment.
Tested (in Talk) and works 👍
Just a little detail, should config and headers be guarded against undefined values when used in the if conditions? For example, in: https://github.com/nextcloud/nextcloud-axios/blob/b1bf15b5097f702fd43f3b365c7fd75dae262fc8/lib/interceptors/maintenance-mode.ts#L17-L20
I guess that it would not be needed, as if status is set to a numeric value then error probably contains also the other expected values, but I do not know if that is guaranteed :-)
@danxuliu Yeah not sure an extra check is needed if we know the status is numeric. We can make it safer later after having faced new crashes 😁. |
| expect(token.token).not.toBe(undefined) | ||
| }) | ||
|
|
||
| it('intercepting a cancellation error', () => { |
There was a problem hiding this comment.
fyi jest tests should be phrased like english sentences starting with it. E.g. it intercepts a cancellation error. That makes the outputs human readable. ref https://jestjs.io/docs/api#testname-fn-timeout
There was a problem hiding this comment.
Oh right thanks. Will fix this.
And what about the test content? Are you fine with it?
There was a problem hiding this comment.
Yes, that looks fine
There was a problem hiding this comment.
If I may be nitpicky then it would be better if the tests were moved to the individual test suites for the modules
|
This seems to break talks long polling as it automatically aborts now after 10 seconds, instead of waiting for the 30s response |
|
@nickvergessen I'm not sure this change can have an effect on the request timeout. It only affects how errors are handled once an error happens. |
|
I downgraded to 2.1.0 of this lib and now it works again. Seems the problem is from CancelableRequests: |
|
Hmm downgrading didn't fix. I forgot to revert decreasing the timeout on PHP level. |
closes #548
Some
errorattrs are not defined when a request is canceled (withAbortControllerorCancelToken).