跳到主要内容

@ContentType

该设置仅在Post、Put、Patch等方法下生效,用来定义传参方式,以便后台做对应的解析,用法:@ContentType 类型。 不设置ContentType默认为application/json

类型 只能为application/x-www-form-urlencodedmultipart/form-dataapplication/jsontext/plain其中的一个值。

示例:

/**
* @Api post /api/info/addNew
* ...
* @BodyParam {String} name 姓名字段
* @BodyParam {Number} [age] 年龄字段(可选)
*
* @ContentType application/json
* ...
*/