Closed illyar80 closed 3 years ago
Hi, its not problem for my code:
if (Yii::$app->request->post('body')) { $post = json_decode(Yii::$app->request->post('body'), true); } else { $post = Yii::$app->request->post(); }
@illyar80 this approach is breaking the consistency, because your code suppose to look as Yii::$app->request->post()
instead of Yii::$app->request->post('body')
.
Until this issue is resolved I cannot approve the pull request. You might just use your own repository in composer.json in case this inconsistency is OK for you.
Ok, thank you for your explanation and for the spending time.
@illyar80 Hi! After we show the body field, the
Yii::$app->request->bodyParams
will have not expected value, which will consist actual body as a property with string value. It will also haveurl
andmethod
properties additionally, which should not be a part of thebodyParams
, e.g.:{"method":"POST","url":"/test","body":"{\r\n \"a\": \"\",\r\n \"b\": \"\"\r\n}"}
So I guess there's no point showing Body field until this problem is resolved. Its probably some setting in the
doc.js
for ajax request parameters. I'm not sure what exactly it should be. If you have time look into this and this issue will be fixed, then I can accept the pull request.