AWS API Gateway更改内容类型 [英] AWS API Gateway Change Content Type

查看:210
本文介绍了AWS API Gateway更改内容类型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望有人能提供帮助,我让AWS Lambda在context.succeed或context.fail中返回了一些XML.我回显了XML,但是因为标头仍然具有Content-Type: application/json,而我也在说的Twilio服务器也在查看并拒绝它,即使主体实际上是有效的XML.

I'm hoping someone can help, I've got AWS Lambda returning some XML in context.succeed or context.fail everything is excellent apart from one small part. I echo out the XML, but because the header still has Content-Type: application/json and the Twilio server I'm talking too is looking at this and rejecting it even though the body is actually valid XML.

有没有一种方法可以覆盖标题?

Is there a way to override the header?

非常感谢.

推荐答案

如果您查看API Gateway控制台并选择有问题的方法,则应该在右侧看到标题为 Method Response 的部分.边.如果选择应该看到的各种响应代码,则可以添加一个或选择一个现有的代码,然后更改与该响应关联的Content-Type.

If you look in the API Gateway console and select the method in question, you should see a section titled Method Response on the right side. If you select that you should see the various response codes and you can add one or select an existing one and change the Content-Type associated with that response.

这篇关于AWS API Gateway更改内容类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆