繁体   English   中英

昂首阔步地发送空的帖子请求

[英]Swagger sending empty post requests

我只是为laravel 5.1(旧项目)设置了摇摇欲坠的东西,我为我的项目写了整个文档,但是问题是当我去尝试一下! 它发送空请求。 当我和邮递员尝试完全相同的事情时,它的工作原理与预期的一样。

这是一个例子:

 /**
 * @SWG\Post(
 *     path="/api-routes/verify-report",
 *     consumes={"multipart/form-data"},
 *     description="Verify report",
 *     operationId="verifyReport",
 *     @SWG\Parameter(
 *         description="Application report id",
 *         format="int64",
 *         in="path",
 *         name="report_id",
 *         required=true,
 *         type="string"
 *     ),           
 *     produces={"application/json"},
 *     @SWG\Response(
 *         response="200",
 *         description="successful operation"
 *     ),
 *     summary="Verify report",
 *     tags={
 *         "Verify report"
 *     }
 * )
 * */
public function verifyReport() {

}

我正在使用

"darkaonline/l5-swagger": "~3.0"

您只需要更改以下几项更改即可。

/**
 * @SWG\Post(
 *     path="/api-routes/verify-report",
 *     consumes={"multipart/form-data"},
 *     description="Verify report",
 *     operationId="verifyReport",
 *     consumes={"application/x-www-form-urlencoded"},
 *     produces={"application/json"},
 *     @SWG\Parameter(
 *         description="Application report id",
 *         in="forData",
 *         name="report_id",
 *         required=false,
 *         type="string"
 *     ), 
 *     @SWG\Response(
 *         response="200",
 *         description="successful operation"
 *     ),
 *     summary="Verify report",
 *     tags={
 *         "Verify report"
 *     }
 * )
 * */
public function verifyReport() {

}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM