AWS Api Gateway的参数验证 [英] Parameter Validation for AWS Api Gateway

查看:263
本文介绍了AWS Api Gateway的参数验证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

因此,我在Api网关上创建了一个资源和一个GET操作.我通过方法执行和通过映射模板的集成请求正确地传递了我的url参数.目前,我让Api端点在命中时执行Lambda函数,并且Lambda函数中有参数验证.我希望Api Gateway可以告诉我为我验证url参数的方法.但是我找不到任何教我如何做的文档或博客.我在上一篇文章中听说,如果人们对AWS提出足够的抱怨,此功能可能会在以后推出,但这和去年一样.

So I created a resource and a GET action on my Api Gateway. I correctly pass my url parameters through Method Execution and through Integration Request via Mapping Templates. Currently I am having my Api endpoint execute a Lambda function when hit and there are parameter validates in my Lambda function. I was hoping there would be a way for Api Gateway to tell me validate the url parameters for me. But I can't find any documentation or blog that teaches me how to do that. I heard in a previous post that this feature may come in later if people complain to AWS enough, but that was like last year.

推荐答案

这仍在我们的积压中,我们尚未验证传入的参数.

This is still on our backlog, we don't yet validate incoming parameters.

我们必须执行的功能请求只是验证它们是否存在.基本上,您会说一个参数是必需的,然后如果缺少该参数,API Gateway将在到达Lambda函数之前拒绝该请求.

The feature request we have to is just validating that they are present. Basically you would say a parameter is required and then if the parameter was missing, API Gateway would reject the request before it reached the Lambda function.

这篇关于AWS Api Gateway的参数验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆