无法通过邮递员提交请求提交表单数据 [英] Could not submit form-data through postman put request

查看:79
本文介绍了无法通过邮递员提交请求提交表单数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用流明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

这篇关于无法通过邮递员提交请求提交表单数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆