diff --git a/src/plugins/http-fetch.ts b/src/plugins/http-fetch.ts index f95135c9..a0f961fd 100644 --- a/src/plugins/http-fetch.ts +++ b/src/plugins/http-fetch.ts @@ -300,18 +300,28 @@ export async function request(options: OptionsType): Promise { * @returns */ function stateCode(res: Response) { + // 网络异常 if (res.status === 500) { return { code: RESULT_CODE_ERROR, msg: RESULT_MSG_SERVER_ERROR, }; } + // 上传文件成功无内容返回 + if (res.status === 204 && res.statusText === 'No Content') { + return { + code: RESULT_CODE_SUCCESS, + msg: RESULT_MSG_SUCCESS, + }; + } + // 地址找不到 if (res.status === 404) { return { code: RESULT_CODE_ERROR, msg: RESULT_MSG_URL_NOTFOUND, }; } + // 身份授权 if (res.status === 401) { removeToken(); window.location.reload();