2 回答
TA贡献1848条经验 获得超10个赞
您可以创建一个请求模板,该模板将使用参数映射您的请求内容,如文档中所述。您的函数将如下所示(例如,如果要采用参数:page
myFunc:
handler: com.mcm.in.MyHandler
events:
- http:
path: user
method: get
cors: true
integration: lambda
request:
template:
application/json: '{ "page" : "$input.params(''page'')" }'
TA贡献1883条经验 获得超3个赞
我以这种方式创建了请求模板,用于在URL中传递多个参数
template:
application/json: '{ "userid":"$input.params(''userid'')","activityid":"$input.params(''activityid'')"}'
这是完整的代码
functions:
hello:
handler: handler.hello
events:
- http:
path: /
method: get
likes:
handler: handler.likes
events:
- http:
path: /likes
method: get
integration: lambda
reqValidatorName: xMyRequestValidator
request:
passThrough: NEVER
parameters:
querystrings:
userid: true
activityid:true
template:
application/json: '{ "userid":"$input.params(''userid'')","activityid":"$input.params(''activityid'')"}'
response:
headers:
Content-Type: "'application/json'"
添加回答
举报