首页 > 解决方案 > swagger editor 2.0 下载excel文件

问题描述

我正在尝试使用 swagger 编辑器下载 GET API 返回的 excel 文件内容,但我不知道该怎么做。

当我使用邮递员发送和下载时,我的 API 工作正常。

招摇编辑器 yaml 文件:

paths:
    /download_file:
        get:
          operationId: "getFile"
          produces:
          - "application/vnd.ms-excel"
          responses:
            "200":
              description: "Report downloaded"
              schema:
                type: string
                format: binary
              headers:
                Content-Type:
                  type: string
                Content-Disposition:
                  type: string

这里我使用的是 swagger 2.0。

标签: swaggerswagger-2.0swagger-editor

解决方案


推荐阅读