优化
This commit is contained in:
@@ -63,6 +63,23 @@ describe('API error diagnostics', () => {
|
||||
})
|
||||
})
|
||||
|
||||
it('explains a proxy 413 response without a JSON error envelope', () => {
|
||||
const error = new axios.AxiosError('Request failed', 'ERR_BAD_REQUEST', undefined, undefined, {
|
||||
status: 413,
|
||||
statusText: 'Payload Too Large',
|
||||
headers: {},
|
||||
config: { headers: new AxiosHeaders() },
|
||||
data: '<html>Request Entity Too Large</html>',
|
||||
})
|
||||
|
||||
expect(getApiErrorDetails(error)).toEqual({
|
||||
message: '上传文件的请求体过大,服务器已拒绝;请压缩后重试,如文件未超过 5MB,请联系管理员检查网关上传限制',
|
||||
code: 'HTTP_413',
|
||||
requestId: undefined,
|
||||
traceId: undefined,
|
||||
})
|
||||
})
|
||||
|
||||
it('notifies session expiry once when concurrent 401 requests share a failed refresh', async () => {
|
||||
const refresh = vi.fn(async () => { throw new Error('refresh token expired') })
|
||||
const expired = vi.fn()
|
||||
|
||||
Reference in New Issue
Block a user