如何使用proxy +处理api网关上的根资源以返回正文? [英] how can I use proxy+ to handle the root resource on api gateway to return body?

查看:103
本文介绍了如何使用proxy +处理api网关上的根资源以返回正文?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

带有proxy +的API网关对我来说很好用,唯一的问题是根路径始终返回缺少身份验证令牌",因此我发现我应该为根路径设置"ANY"方法,但是它将返回响应json中的标头.

API Gateway with proxy+ works fine for me, the only thing is that the root path always return "Missing Authentication Token", so I found I should setup "ANY" method for the root path, but it would return the response with header in json.

{
  "statusCode": 200,
  "body": "{\"message\":\"Welcome!\"}",
  "headers": {
    "x-powered-by": "Express",
    "access-control-allow-origin": "*",
    "content-type": "application/json; charset=utf-8",
    "content-length": "22",
    "etag": "W/\"16-XP9xOOkLTTczHdpNV2DV26X8ykM\"",
    "date": "Tue, 03 Mar 2020 01:15:05 GMT",
    "connection": "close"
  },
  "isBase64Encoded": false
}

我怎样才能只退还尸体?

how can I get return only the body?

推荐答案

我找到了解决方案,当我们在根目录上设置"get"(或"any")方法时,可以只使用代理.

I found the solution, we could just use proxy when we setup the "get" (or "any") method on root.

如果您已经在方法上设置了,则可以根据集成请求对其进行更新

if you have already setup the on the method, you update it on integration request

这篇关于如何使用proxy +处理api网关上的根资源以返回正文?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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