You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I noticed that while making batch requests, 401 Unauthorized responses are not caught in the current handler because they return an HTTP status code of 200, and each error is presented in a JSON array in the response body.
I managed to temporarily fix this by changing the OAuth2Client.prototype.request function:
from:
var hasAuthError = (res.statusCode == 401 || res.statusCode == 403)
to:
// TODO: Check if it's not userRateLimitExceeded
var hasAuthError =
(res.statusCode == 401 || res.statusCode == 403)
|| body.indexOf('401 Unauthorized') >= 0; // batch requests
A deep copy of the request options must be cached:
from:
var that = this;
var credentials = this.credentials;
to:
var optsClone = JSON.parse(JSON.stringify(opts));
var that = this;
var credentials = this.credentials;
OData batches implemented by this client library is quite experimental. As long as, I don't have a native http implementation to parse the multipart segments, batch requests are not that useful at all. So, I'm on hold for now to fix known error handling issues with batch requests.
I noticed that while making batch requests, 401 Unauthorized responses are not caught in the current handler because they return an HTTP status code of 200, and each error is presented in a JSON array in the response body.
I managed to temporarily fix this by changing the OAuth2Client.prototype.request function:
from:
to:
A deep copy of the request options must be cached:
from:
to:
and used for the request when it is re-played
from:
to:
I'm sure there is probably a more elegant way of fixing this instead of using "indexOf", but this should help people having the same problem for now.
The text was updated successfully, but these errors were encountered: