无法通过邮递员提交请求提交表单数据

问题描述:

我正在使用流明API 5.6. 这是我的路线 $ router-> PUT('collections/{collectionId}' 在邮递员中,我这样称呼这个api.

I m using lumen api 5.6. This is my route $router->PUT('collections/{collectionId}' In postman i m calling this api like this.

这是该请求的正文

请参阅此处,我在此处具有CollectioPoints,但其验证失败. 通过formdata发送的数据无法在验证中识别.

See here i have CollectioPoints here but its failing in validation. the data i m sending through formdata is not able to recognized in validation.

但是,如果我将路由从put发送到post [$ router-> POST('collections/{collectionId}']],则通过表单数据发送的所有数据都将被识别,并且得到如下所示的正确响应

But if i send the route from put to post [$router->POST('collections/{collectionId}'], all the data i m sending through form data are recognized and i m getting correct response as below

为什么会这样.不能通过看跌期权请求发送表格数据吗? 谢谢你.

Why this is happening. Cant i send form data through put request? Thaank you.

Laravel(Lumen)作弊,因为html表单仅支持GET和POST,但它确实了解真正的PUT/PATCH请求.

Laravel(Lumen) cheats because html forms only support GET and POST, but it does understand a real PUT/PATCH request.

在邮递员中,您应该发送POST并将_method设置为PUT(与发送表单相同),以使数据和文件可见

In Postman You should send POST and set _method to PUT (same as sending forms) to make your data and files visible

 _method = "PUT"

如果您没有任何文件,仅包含数据,则可以在邮递员的以下选择选项中写入参数

If you don't have any file only have data then you can write you parameter in choose below option in Postman

 x-www-form-urlencode 

您要使用PUT方法发送带有 form-Data 选项的数据,则应使用这样的内容 https://gist.github.com/devmycloud/df28012101fbc55d8de1737762b70348

You want use PUT method for send Data with form-Data option you should use stuff like this https://gist.github.com/devmycloud/df28012101fbc55d8de1737762b70348