diff --git a/src/api/oauth.js b/src/api/oauth.js index 7ecb0cc3f..b774b3f6c 100644 --- a/src/api/oauth.js +++ b/src/api/oauth.js @@ -2,8 +2,6 @@ import { reduce } from 'lodash' import { paramsString, promisedRequest } from './helpers.js' -import { StatusCodeError } from 'src/services/errors/errors.js' - const REDIRECT_URI = `${window.location.origin}/oauth-callback` export const MASTODON_APP_VERIFY_URL = '/api/v1/apps/verify_credentials' diff --git a/src/services/errors/errors.js b/src/services/errors/errors.js index 00dfd3712..a28f31775 100644 --- a/src/services/errors/errors.js +++ b/src/services/errors/errors.js @@ -13,7 +13,7 @@ function humanizeErrors(errors) { export function StatusCodeError(statusCode, body, options, response) { this.name = 'StatusCodeError' this.statusCode = statusCode - this.statusText = body.error.error || body.error + this.statusText = body.error || body this.details = JSON && JSON.stringify ? JSON.stringify(body) : body this.errorData = body.error this.message = this.statusCode + ' - ' + this.statusText diff --git a/test/unit/specs/stores/oauth.spec.js b/test/unit/specs/stores/oauth.spec.js index c4f4ba978..828175c9f 100644 --- a/test/unit/specs/stores/oauth.spec.js +++ b/test/unit/specs/stores/oauth.spec.js @@ -69,6 +69,12 @@ describe('oauth store', () => { it('should use create an app and record client id and secret', async ({ worker, }) => { + worker.use( + http.post(MASTODON_APP_URL, () => { + return HttpResponse.text('Throttled', { status: 429 }) + }), + ) + const store = useOAuthStore() worker.use(...authApis()) const app = await store.createApp()