Skip to content

Commit c530be0

Browse files
committed
fix: ensure contentType is treated as a string in error response check
- Updated the error response check in transform.tsx to explicitly cast contentType as a string, improving type safety and preventing potential runtime errors.
1 parent 0fe37c4 commit c530be0

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/utils/request/transform.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ export const transform: AxiosTransform = {
289289

290290
// 判断是否为错误响应:Content-Type 是 JSON 且没有 Content-Disposition
291291
// 正常文件下载会有 Content-Disposition 头
292-
const isErrorResponse = contentType.includes('application/json') && !contentDisposition;
292+
const isErrorResponse = (contentType as string).includes('application/json') && !contentDisposition;
293293

294294
if (isErrorResponse) {
295295
try {

0 commit comments

Comments
 (0)