【发布时间】:2018-12-16 23:55:39
【问题描述】:
是否可以在 API Gateway 的正文映射模板中的引用后直接使用点?
我像这样进行字符串连接:
#set($region = "us-east-2")
#set($apiid = "$context.apiId")
#set($stage = "$context.stage")
#set($path = "search/stac")
"url": "https://$apiid.execute-api.$region.amazonaws.com/$stage/$path"
问题是 $apiid 和 $region 没有被取消引用。结果如下所示。
"url: "https:// .execute-api. .amazonaws.com/dev/search/stac
如果我使用没有字符串连接的引用,它们具有预期值。所以 #set 操作似乎是正确的。
我认为它会将引用后的点误认为是函数调用。 Velocity 模板语言中的点如何转义?
【问题讨论】:
标签: amazon-web-services aws-api-gateway string-concatenation vtl apache-velocity