pak*_*ore 5 binary header http amazon-web-services aws-api-gateway
根据http://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-payload-encodings.html
If contentHandling is not defined, and if the Content-Type header of the response and the Accept header of the original request match an entry of the binaryMediaTypes list, API Gateway passes through the body. This occurs when the Content-Type header and the Accept header are the same; otherwise, API Gateway converts the response body to the type specified in the Accept header.
我无法发出原始请求发送Accept标头.如何让我的AWS API Gateway以二进制格式返回?(图像/ JPEG).因为我从s3发回的图像在最后一个阶段被转换为文本(因为原始请求缺少Accept: image/jpeg标题).
将集成响应中的"内容处理"设置为"转换为二进制".在集成响应中设置转换为二进制时,Content-Type API网关响应标头为'*/*',因此您需要在Content-Type的集成响应中创建标头映射,映射到integration.response.header.内容类型.这将确保API网关响应包含后端在API网关响应中传递的相同Content-Type值.
需要明确的是,这里是所需设置的摘要.
整合响应:
这消除了客户端对Accept请求标头的需要.
| 归档时间: |
|
| 查看次数: |
1432 次 |
| 最近记录: |