通过AWS API网关返回图片 [英] Returning images through AWS API Gateway
问题描述
我试图使用AWS API网关作为影像服务的前面的代理。 我能够获得图像才能通过,但因为内容类型是越来越设置为application / JSON。
I'm trying to use AWS API Gateway as a proxy in front of an image service. I'm able to get the image to come through but it gets displayed as a big chunk of ASCII because Content-Type is getting set to "application/json".
有没有办法告诉网关不改变源内容类型呢?
Is there a way to tell the gateway NOT to change the source Content-Type at all?
我只是想为image / jpeg,图像/ PNG等才能通过。
I just want "image/jpeg", "image/png", etc. to come through.
推荐答案
我试图格式化字符串返回W / O型的报价,发现集成响应功能。我还没有尝试过这种修复自己,但这些方针的东西应该工作:
I was trying to format a string to be returned w/o quotes and discovered the Integration Response functionality. I haven't tried this fix myself, but something along these lines should work:
- 转到您的资源的方法执行页,
- 点击上集成响应,
- 在扩展方法响应状态200,
- 在扩展映射模板,
- 点击应用/ JSON,
- 单击旁边的输出铅笔中转,
- 在变应用/ JSON的到图像/ PNG
希望工程!
这篇关于通过AWS API网关返回图片的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!