[英]AWS Gateway API and file response
Is it possible for AWS Gateway API to respond with a file (zip file) from a HTTP endpoint integration? AWS Gateway API是否可以使用HTTP端点集成中的文件(zip文件)进行响应? I heard somewhere AWS Gateway API doesn't support binary formats but wasn't sure if that was for input or input and output.
我听说AWS Gateway API不支持二进制格式,但不确定是否用于输入或输入和输出。
I have an existing HTTP endpoint and I want to add AWS Gateway API over it; 我有一个现有的HTTP端点,我想在其上添加AWS Gateway API; it currently returns a file (zip) on the response.
它当前在响应上返回一个文件(zip)。
You cannot respond with a Zip(any binary type) file using API Gateway so far. 到目前为止,您无法使用API网关响应Zip(任何二进制类型)文件。 (As stated in AWS official forum )
(如AWS官方论坛中所述 )
As a work around, you can store your file on S3 and dispatch the link of the file using API Gateway. 作为解决方法,您可以将文件存储在S3上,并使用API网关分发文件的链接。
Binary payloads are not yet natively supported as API Gateway currently encodes content as UTF-8. 由于API网关当前将内容编码为UTF-8,因此尚未本地支持二进制有效负载。 For the purposes of serving files, serving them via S3 may be an appropriate workaround.
出于提供文件的目的,通过S3提供它们可能是一种适当的解决方法。 You could configure your API to return a link to S3 or to redirect to the public S3 URL.
您可以配置API以返回指向S3的链接或重定向到公共S3 URL。
Thanks, Ryan 谢谢,瑞恩
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.