【问题标题】:Can't add new attributes to the HTTP headers along with the existing request headers无法将新属性与现有请求标头一起添加到 HTTP 标头
【发布时间】:2018-05-20 05:51:34
【问题描述】:

我的目标是将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"
}

【问题讨论】:

    标签: aws-api-gateway serverless api-gateway


    【解决方案1】:

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

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-02-15
      • 1970-01-01
      • 2012-12-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多