Skip to content

Commit 3c65223

Browse files
author
githubnull
committed
fix: 修复HTTP请求信息页面GET请求错误显示body内容的问题
1 parent e822e2c commit 3c65223

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

src/frontEnd/src/utils/requestFormatter.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,11 @@ export function formatHttpRequest(httpInfo: any, task: any): string {
3737
}
3838

3939
// 4. 内容长度头(如果有请求体)
40-
const body = httpInfo?.body || task?.body
40+
// 重要:只使用 httpInfo.body,不回退到 task.body
41+
// 因为后端API已经返回了正确的body信息,task.body可能来自其他数据源
42+
const body = (httpInfo?.body !== undefined && httpInfo?.body !== null && httpInfo?.body !== '')
43+
? httpInfo.body
44+
: null // 不再回退到 task.body
4145
if (body) {
4246
const contentLength = new TextEncoder().encode(body).length
4347
lines.push(`Content-Length: ${contentLength}`)

0 commit comments

Comments
 (0)