oasp / oasp4js

OASP4JS deprecated repository
Apache License 2.0
9 stars 161 forks source link

oaspUnauthenticatedRequestResender likely to break promise chaining when rejected by authenticator #57

Open dumbNickname opened 9 years ago

dumbNickname commented 9 years ago

Hi,

When authentication is rejected, cancelAllAwaitingRequestsOnFailure is executed, which goes through the queue of responses and calls 'cancel' for all of them. Unfortunately cancel rejects a promise with no value provided. Interceptor plays with HTTP responses so it should always provide something compatible with this API. It is very likely to break promises chaining here, as failure callbacks might blindly try to read some basic information from response like data, status, url, headers etc. (in order to provide some feedback to the user).

I would propose to return original unauthorized response in case of canceling.

Cheers, Bartek