Trace: fetch/XHR response bodies hidden in the player on Safari (content.mimeType is empty)
維護者通常 1 天內回覆
評估
- 難度
- 2/5
- 預估耗時
- 1-3 小時
- 新手友好度
- 72/100
- Issue 類型
- 缺陷
- 描述清晰度
- 描述清楚
- 活躍度
- 活躍
- 技術堆疊
- typescript
- 領域
- tooling
研究方向
從 packages/trace/src/trace-har.ts 第 138 行附近的 content.mimeType 指派開始,該處只讀取 entry.response?.mimeType。檢查頁面收集器的 responseHeaders 如何傳到該筆項目,然後加入回退到 content-type 標頭的邏輯,並去除其中的所有參數。完成的標準是:來自 Safari 追蹤的 fetch/XHR 項目能取得文字類型的 mimeType,且其回應內容會顯示在 Network 分頁中;一個只提供 responseHeaders 的項目經過轉換器處理的測試可以驗證這一點。
由索引模型根據 Issue 內容生成。
描述
What happens
In trace mode on iOS Safari (Appium XCUITest, no WebDriver BiDi), the Network tab of show-trace shows response headers for the page's fetch/XHR calls, but never the response body.
The body is in the trace. The resource-snapshot entries in trace.network carry response.content.text (or _sha1 with the file under resources/), and response.headers contains content-type: application/json. But response.content.mimeType is "":
"response": {
"status": 200,
"headers": [{ "name": "content-type", "value": "application/json" }, ...],
"content": { "size": 1297, "mimeType": "", "text": "{\"id\":...}", "_sha1": "..." }
}
The player only reads a body when the mime type is textual (/json|xml|javascript|ecmascript|^text\// in the trace parser, for both inline text and _sha1), so every body is dropped.
Cause
packages/trace/src/trace-har.ts:138
const mimeType = entry.response?.mimeType ?? ''
The requests the page collector records (the fetch/XHR patch that serves Safari and Appium sessions) carry responseHeaders but no response.mimeType. With no fallback, content.mimeType ends up empty.
Suggested fix
Fall back to the content-type header:
const headers = entry.response?.headers ?? entry.responseHeaders
const mimeType =
entry.response?.mimeType ||
String(headers?.['content-type'] ?? '').split(';')[0].trim()
We applied the same change as a local patch to the built dist/index.js. After it, all 21 fetch/XHR entries in our trace have mimeType: application/json, and their bodies are readable. Setting response.mimeType where the collector's requests are ingested would fix it at the source too.
Environment
@wdio/devtools-service11.2.0 (@wdio/devtools-app1.13.0), WebdriverIO 9.33.1- Appium 3.5, XCUITest driver 12.22.8, iOS 18.6 Simulator, Safari
- Service options:
{ mode: 'trace', traceFormat: 'zip', traceGranularity: 'spec' }
- 主要語言
- TypeScript
- 星號
- 10
- 分支
- 4
- 平均合併
- 1 天 11 小時
- 30 天內合併 PR
- 76
環境準備
- 沒有 Dockerfile 或 Docker Compose 檔案
- 有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
webdriverio/devtools 的其他 Issue
-
難度 4/5 3-5 天 新手友好度 57/100
webdriverio/devtools#585 ·
維護者通常 1 天內回覆
-
難度 4/5 3-5 天 新手友好度 44/100
webdriverio/devtools#584 ·
維護者通常 1 天內回覆
-
Python: capture the native element tree per action in trace mode可能已有人在做 @vishnuv688 於 15 天前認領。 未關閉
webdriverio/devtools#570 · 1 則留言 · 已指派 1 人 ·
維護者通常 1 天內回覆
-
Trace query MCP server: let coding agents debug a failed run from its trace.zip可能已有人在做 @vishnuv688 於 27 天前認領。 未關閉enhancement
webdriverio/devtools#493 · 已指派 1 人 ·
維護者通常 1 天內回覆
查看 webdriverio/devtools 的全部 Issue
相似的 Issue
-
難度 2/5 1-3 小時 新手友好度 82/100
garrytan/gbrain#10437 · 1 則留言 ·
維護者通常 1 天內回覆
-
Bedrock "Too many tokens" throttle is not auto-retried, unlike "Too many requests"可能已有人在做 @acmerfight 今天認領。 未關閉untriaged
難度 2/5 1-3 小時 新手友好度 78/100
earendil-works/pi#12573 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 70/100
agentes-chat/agentes-chat#1506 ·
維護者通常 1 天內回覆
-
comp/desktop desktop/files os/windows P2 type/perf
難度 2/5 1-3 小時 新手友好度 80/100
NousResearch/hermes-agent#160359 ·
維護者通常 1 天內回覆
-
Missing repro Platform: Android
難度 2/5 1-3 小時 新手友好度 76/100
software-mansion/react-native-reanimated#11554 · 1 則留言 ·
維護者通常 1 天內回覆