【问题标题】:How to add multipart/mixed MIME boundary in Content-Type header in Swagger如何在 Swagger 的 Content-Type 标头中添加多部分/混合 MIME 边界
【发布时间】:2015-05-11 02:56:23
【问题描述】:

在 Swagger UI 中,有没有办法提供可以包含在 Content-Type 标头中的 MIME 边界?

使用 Swagger,我可以使用 Swagger Spec 中的 consumes 属性在 Swagger UI 中生成/提交不同的内容类型,例如application/jsonapplication/xml 等。但是,我需要提供每个请求可能不同的 MIME 边界。例如,在来自 RFC 2049 的以下 Content-Type 标头中,最好将唯一边界值作为文本字段输入到 UI 中。有没有在规范中指出这一点?

Content-Type: multipart/mixed; boundary=unique-boundary-1

【问题讨论】:

  • 为什么需要将其定义为 UI 的一部分?这应该由 ui 自动生成。
  • 如果我使用"consumes" : ["multipart/mixed"],UI 当前正在发送multipart/mixed; charset=UTF-8,而不是从body 参数中提取边界字符串。我需要做些什么让 UI 自动将其解析出正文并将其包含在 Content-Type 标头中吗?

标签: mime-types swagger swagger-ui


【解决方案1】:

目前不支持此功能,但已在 Github 上的 Swagger.Next 提案中被接受为可能的增强功能:

https://github.com/swagger-api/swagger-spec/issues/303

【讨论】:

    猜你喜欢
    • 2015-09-26
    • 2016-01-30
    • 1970-01-01
    • 2014-03-09
    • 1970-01-01
    • 2014-06-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多