无法在控制台测试中出现的 Postman 中查看 JSON 响应正文

Unable to view JSON response body in Postman which is present in console test

我在 API 网关中使用 API 密钥和模拟集成设置了一个资源。当我在控制台中测试时,我可以看到我在集成响应中设置的固定 JSON 响应。

但是,当我使用 Postman 进行外部测试时,我可以在响应 (201) 中看到预期的状态代码,但响应主体为空。

谁能解释一下为什么会这样?

非常感谢

请确认一下,您是否部署了最新版本的 API?我使用了下面的示例 API,它对我来说效果很好。你能试试这个吗?

{
  "swagger": "2.0",
  "info": {
    "version": "2016-04-19T19:54:16Z",
    "title": "my-mock-api"
  },
  "basePath": "/prod",
  "schemes": [
    "https"
  ],
  "paths": {
    "/": {
      "get": {
        "consumes": [
          "application/json"
        ],
        "produces": [
          "application/json"
        ],
        "responses": {
          "200": {
            "description": "200 response",
            "schema": {
              "$ref": "#/definitions/Empty"
            }
          }
        },
        "x-amazon-apigateway-integration": {
          "responses": {
            "default": {
              "statusCode": "200",
              "responseTemplates": {
                "application/json": "{\"test\":\"test\"}"
              }
            }
          },
          "requestTemplates": {
            "application/json": "{\"statusCode\": 200}"
          },
          "type": "mock"
        }
      }
    }
  },
  "definitions": {
    "Empty": {
      "type": "object"
    }
  }
}