首页 文章

未记录的TypeError:无法在swagger中获取有效的json响应

提问于
浏览
0

我想为我的后端制作一个swagger客户端文档 . 我有获得json响应的问题 . (我测试了注册api)当我尝试使用swagger客户端注册时,我可以确认新用户在数据库中正确保存 . 但它无法让json响应我的api发送的内容 . 这是一个招摇的部分 .

responses:
    '200':
      description: successful operation
      schema:
        $ref: '#/definitions/ApiResponse'
 definitions:
  ApiResponse:
    type: object
    properties:
      result:
        type: integer
        format: int64
      errorCode:
        type: string
      errorMsg:
        type: string

当我使用邮递员测试api时,它会发送状态代码为200的json对象

{
   "result":false,
   "errorCode":"00002",
   "errorMsg": "Same Account already exists!"
}

但是,它说是招摇

Code                 Details
Undocumented         TypeError: Failed to fetch

它正确地保存了数据,只是我无法获得json响应 . 谢谢 .

1 回答

  • 0

    我注意到的是“结果”类型应该是一个布尔值 .

相关问题