Swagger v2 405 error Error: No implementation found for this path

Swagger v2 405 error Error: No implementation found for this path

我明白了!现在觉得自己好傻。

我忘了添加:

x-swagger-router-controller: webhook

就在 post: 标签之前

我保留了下面的原始详细信息并进行了修复:

我正在测试来自支付沙箱的 webhook,但我不断收到 405 错误:找不到此路径的实现。试图在这里寻找解决方案,但没有找到任何东西。

我正在使用 ngrok 将我的本地开发人员暴露给支付沙箱站点,我可以在其中测试我的端点 url

沙盒中的路径集(我的URL端点)是http s://82d69e226afb.ngrok.io/v1/paymentwebhook/success(我故意在 http 的 s 之后添加了 space 以不创建 link)

这是路径的招摇路线:

  /paymentwebhook/success:
    x-swagger-router-controller: webhook --> **fix**
    post:
      tags:
        - webhook
      summary: Webhook endpoint for success
      operationId: HandleSuccess
      # consumes:
      #   - application/json
      parameters:
        - name: body
          in: body
          description: post contents
          required: true
          schema:
            type: object
            properties:
              id:
                type: string
              amount:
                type: number
              currency:
                type: string
              status:
                type: string
              requestReferenceNumber:
                type: string
      responses:
        200:
          description: Successful payment.
          # schema:
          #   $ref: "#/definitions/PostOperationSuccess"
        401:
          $ref: "#/responses/ErrorResponse401Auth"
        500:
          $ref: "#/responses/ErrorResponse500Server"
    
   

我忘了添加 x-swagger-router-controller 标签。这解决了问题