0

我的目标是添加callerrequest-id到 HTTP 标头。但是,我似乎无法正确处理。这些不会与现有标题一起添加。

怎么了?

{
"headers": {
    #foreach($header in $input.params().header.keySet())
    "$header": "$util.escapeJavaScript($input.params().header.get($header))" #if($foreach.hasNext),#end

    #end

    "caller" : "$context.identity.caller",
    "request-id" : "$context.requestId"
}
4

1 回答 1

0

您是否尝试将其添加到您的集成请求标头中?如果是这样,则在正文映射模板中未配置。映射模板仅用于将有效负载配置到集成。

您应该添加一个名为caller(或任何您想要的)的标题并将映射表达式值设置为$context.identity.caller. 然后 API GW 会将标头中的值发送到您的集成。

于 2017-12-10T18:20:23.197 回答