зеркало из https://github.com/mozilla/fxa.git
fix(subscriptions): respond with empty subscription list fo r 403 error from subhub
This commit is contained in:
Родитель
ec14fc4129
Коммит
725626e36f
|
@ -190,6 +190,9 @@ module.exports = function(log, config) {
|
|||
log.error('subhub.listSubscriptions.1', { uid, err });
|
||||
throw error.unknownCustomer(uid);
|
||||
}
|
||||
if (err.statusCode === 403) {
|
||||
return { subscriptions: [] };
|
||||
}
|
||||
throw err;
|
||||
}
|
||||
},
|
||||
|
|
|
@ -151,6 +151,15 @@ describe('subhub client', () => {
|
|||
assert.deepEqual(resp, expected);
|
||||
});
|
||||
|
||||
it('should yield an empty list for 403 no subscriptions error', async () => {
|
||||
mockServer
|
||||
.get(`/v1/customer/${UID}/subscriptions`)
|
||||
.reply(403, { message: 'No subscriptions for this customer.' });
|
||||
const { subhub } = makeSubject();
|
||||
const resp = await subhub.listSubscriptions(UID);
|
||||
assert.deepEqual(resp, { subscriptions: [] });
|
||||
});
|
||||
|
||||
it('should throw on unknown user', async () => {
|
||||
mockServer
|
||||
.get(`/v1/customer/${UID}/subscriptions`)
|
||||
|
|
Загрузка…
Ссылка в новой задаче