Returning images through AWS API Gateway

前端 未结 3 1157
轮回少年
轮回少年 2020-12-30 05:56

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

3条回答
  •  抹茶落季
    2020-12-30 06:37

    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:

    • Go to the Method Execution page of your Resource,
    • click on Integration Response,
    • expand Method Response Status 200,
    • expand Mapping Templates,
    • click "application/json",
    • click the pencil next to Output Passthrough,
    • change "application/json" to "image/png"

    Hope it works!

提交回复
热议问题