다음 예시에서는 ServiceCallout 정책이 API 프록시 요청에 있으며 콜아웃 응답에 동일한 이름(Set-Cookie
)의 헤더가 여러 개 포함되어 있다고 가정합니다. 서비스 콜아웃의 응답 변수가 기본값 calloutResponse
라고 가정하면 다음 정책에서 두 번째 Set-Cookie
헤더 값을 가져옵니다.
<AssignMessage continueOnError="false" enabled="true" name="get-header"> <Set> <Payload contentType="application/json"> {"Cookies from Service Callout":" {calloutResponse.header.Set-Cookie.2}"} </Payload> </Set> <IgnoreUnresolvedVariables>true</IgnoreUnresolvedVariables> <AssignTo createNew="false" transport="http" type="request"/> </AssignMessage>
모든 헤더 값을 나열하려면 다음 변수를 대신 사용합니다.
{calloutResponse.header.Set-Cookie.values}