在下列範例中,假設 API Proxy 要求中有 ServiceCallout 政策,且呼叫回應包含多個同名標頭 (Set-Cookie
)。假設服務呼叫的回應變數是預設的 calloutResponse
,下列政策會取得第二個 Set-Cookie
標頭值。
<AssignMessage name="AM-Payload-from-SC-header"> <Set> <Payload contentType="application/json"> {"Cookies from Service Callout":" {calloutResponse.header.Set-Cookie.2}"} </Payload> </Set> <IgnoreUnresolvedVariables>true </IgnoreUnresolvedVariables> <AssignTo>response</AssignTo> </AssignMessage>
如要列出所有標頭值,請改用下列變數:
{calloutResponse.header.Set-Cookie.values}