新手问题 关于 swagger 的问题

liuyang_1991 · 2018年03月05日 · 最后由 liuyang_1991 回复于 2018年03月06日 · 2097 次阅读

请问怎么修改 application/json 为 Content-type: application/x-www-form-urlencoded

liuyang_1991 [北京] 星起招聘 Ruby 工程师 提及了此话题。 03月05日 23:20

没看懂 form-urlencoded 不就是一般的 HTTP 表单提交么,用 postman 之类很容易模拟吧,你要是调网络库不也是看 API 写的事么?

这是一个 swagger 文档的问题,还是通信的问题?

zhandao 回复

swagger 的问题,就是非 get 得请求 content-type 是 application/json, 想改成 application/x-www-form-urlencoded

liuyang_1991 回复

?那把 yml 里中的媒体类型改掉不就是了

jasl 回复

嗯!用 postman 是好使的!但是 swagger 都生成文档了,想问问怎么修改,老版本的没有这个问题,改了新版本就有这个问题了,上面的图是 swagger 的官方文档里的,但是不知道怎么在修改

zhandao 回复

给个例子?😂

liuyang_1991 回复

这个不知道了,没用过 Swagger

liuyang_1991 回复

是 swagger2 吧?按 文档,就是改“consumes”呀 ...

You can use the consumes and produces keywords to specify the MIME types understood by your API.

或者说你还有别的意思?

zhandao 回复

嗯嗯!谢谢

需要 登录 后方可回复, 如果你还没有账号请 注册新账号