ในตัวอย่างต่อไปนี้ สมมติว่ามีนโยบาย ServiceCallout ในคำขอพร็อกซี API
และการตอบกลับของ Callout มีส่วนหัวหลายรายการที่มีชื่อเดียวกัน
(Set-Cookie) สมมติว่าตัวแปรการตอบกลับของ Service Callout เป็นค่าเริ่มต้น
calloutResponse นโยบายต่อไปนี้จะรับค่าส่วนหัว Set-Cookie
รายการที่ 2
<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}