HTTP 交換 (httpexchanges)

httpexchanges 端點提供有關 HTTP 請求-響應交換的資訊。

檢索 HTTP 交換

要檢索 HTTP 交換,請向 /actuator/httpexchanges 發出 GET 請求,如以下基於 curl 的示例所示

$ curl 'https://:8080/actuator/httpexchanges' -i -X GET

結果響應類似於以下內容

HTTP/1.1 200 OK
Content-Type: application/vnd.spring-boot.actuator.v3+json
Content-Length: 511

{
  "exchanges" : [ {
    "timestamp" : "2022-12-22T13:43:41Z",
    "request" : {
      "headers" : {
        "Accept" : [ "application/json" ]
      },
      "method" : "GET",
      "uri" : "https://api.example.com"
    },
    "response" : {
      "headers" : {
        "Content-Type" : [ "application/json" ]
      },
      "status" : 200
    },
    "principal" : {
      "name" : "alice"
    },
    "session" : {
      "id" : "7baf7dde-eb28-4571-8579-d787a7413e25"
    },
    "timeTaken" : "PT0.023S"
  } ]
}

響應結構

響應包含跟蹤的 HTTP 請求-響應交換的詳細資訊。下表描述了響應的結構

路徑 型別 描述

交換

陣列

HTTP 請求-響應交換的陣列。

exchanges.[].timestamp

字串

交換髮生的時間戳。

exchanges.[].principal

物件

交換的主體(如果存在)。

exchanges.[].principal.name

字串

主體的名稱。

exchanges.[].request.method

字串

請求的 HTTP 方法。

exchanges.[].request.remoteAddress

字串

接收請求的遠端地址(如果已知)。

exchanges.[].request.uri

字串

請求的 URI。

exchanges.[].request.headers

物件

請求的頭部,以頭部名稱為鍵。

exchanges.[].request.headers.*.[]

陣列

頭部的值

exchanges.[].response.status

數字

響應的狀態

exchanges.[].response.headers

物件

響應的頭部,以頭部名稱為鍵。

exchanges.[].response.headers.*.[]

陣列

頭部的值

exchanges.[].session

物件

與交換關聯的會話(如果存在)。

exchanges.[].session.id

字串

會話的 ID。

exchanges.[].timeTaken

字串

處理交換所花費的時間。

© . This site is unofficial and not affiliated with VMware.