简体   繁体   English

如何在 Google Cloud Functions 中获取 HTTP 请求正文大小?

[英]How to get HTTP request body size in Google Cloud Functions?

I would like to retrieve the size of the request body to filter out the large HTTP post request.我想检索请求正文的大小以过滤掉大型 HTTP post 请求。 So, How can I get the length of the request?那么,我怎样才能得到请求的长度呢?

As per its documentation, Cloud Functions has a hard limit of 10 MB for HTTP request and response payloads.根据其文档,Cloud Functions 对 HTTP 请求和响应负载的硬限制为10 MB For more detail, you can check documentation .有关更多详细信息,您可以查看文档 and also, you cannot extend the limit as well(I have not found yet).而且,您也不能扩展限制(我还没有找到)。

Just to check the length of your request, you can use req.get("content-length") .只是为了检查您的请求的长度,您可以使用req.get("content-length")

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM