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.