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 だけを持つエントリを converter に通すテストで確認できます。
索引モデルが 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時間
- マージ済み PR(30日)
- 76
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- 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 日以内に返信