共用方式為


HarGenerator插件

從截獲的請求和響應生成 HTTP 封存 (HAR) 檔案。

外掛程式實例定義

{
  "name": "HarGeneratorPlugin",
  "enabled": true,
  "pluginPath": "~appFolder/plugins/DevProxy.Plugins.dll",
  "configSection": "harGeneratorPlugin"
}

設定範例

{
  "harGeneratorPlugin": {
    "$schema": "https://raw.githubusercontent.com/dotnet/dev-proxy/main/schemas/v1.3.0/hargeneratorplugin.schema.json",
    "includeSensitiveInformation": false,
    "includeResponse": true
  }
}

設定屬性

房產 Description 預設
includeSensitiveInformation 決定是否在產生的 HAR 檔案中包含敏感資訊 (授權標頭、Cookie 等)。 當設定為 false時,敏感標頭會以 REDACTED false
includeResponse 決定是否要在產生的 HAR 檔案中包含回應本文內容 false

命令列選項

None

備註

HAR (HTTP 封存) 格式是一種以 JSON 為基礎的格式,用於記錄 HTTP 交易。 各種工具廣泛支持它並使用它來:

  • 分析網路流量和效能
  • 偵錯 API 互動
  • 共用 HTTP 工作階段資料
  • 匯入瀏覽器開發人員工具和其他分析工具

includeSensitiveInformation 設定為 false時,外掛程式會自動編輯下列敏感標頭:

  • authorization
  • cookie
  • from
  • proxy-authenticate
  • proxy-authorization
  • set-cookie
  • www-authenticate
  • x-api-key
  • x-auth-token
  • x-csrf-token
  • x-forwarded-for
  • x-real-ip
  • x-session-token
  • x-xsrf-token

產生的 HAR 檔案包括:

  • HTTP 請求詳細資訊(方法、URL、標頭、查詢參數、cookie)
  • HTTP 回應詳細資料 (狀態、標頭、Cookie)
  • 請求和回應本文資料 (如適用)
  • 內容類型和大小
  • HTTP 版本資訊

外掛程式會在記錄停止後,在目前目錄中建立名為 devproxy-{timestamp}.har 的 HAR 檔案。