Closed zaherg closed 7 years ago
I did more testing today with xDebug to check and see if the request does contain any data when using PUT or not, and I found out it does not.
this is the link to the video I recorded https://youtu.be/jAz_3pOcYnU
thanks
nevermind I just used PAW client and it worked. so clearly something going on with Postman or my end.
Yoo Guys, I had this problem with PostMan when i was trying to send a PUT request to laravel api and i got null in $request and I find the solution and it is in the data format i was sending. I was sending form-data as body in order to update so that was the problem i just changed the form-data to raw and it fixed my problem and also i changed my header as: Content-Type : application/json
For me it was because I imported the wrong Request object. I needed to import Illuminate\Http\Request
and instead I accidentally imported Laravel\Lumen\Http\Request
@christhomas You saved my day thanks
First of all, I want to thanks everyone and am really sorry that I have started my conversation in the wrong place, this issue may not be a bug, it may be something am doing wrong and needs a correction from you guys to help me solve it.
Info
Description:
Am using Postman to send PUT request to my route, the body of my postman request is
form-data
and it has only one keyoptions
like in this image.My route has the following:
My controller has the following:
But for some reasons
$request->input('options')
will always be equal tonull
, there for my request fail as shown in this image. and if I dumped$request->all()
I'll get an empty array.now if I changed the body type to
x-www-form-urlencoded
it will work, but this will not allow me to send a file.Steps To Reproduce:
I have recorded this video https://www.youtube.com/watch?v=SvvQ_YhU8JA and I think the whole code in the description above.
Thanks in advance.