PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Tuesday, March 1, 2022

[FIXED] No body data found in Laravel 5.3 with PUT request

 March 01, 2022     laravel, laravel-5, laravel-5.3, rest     No comments   

Issue

Here is my route to update the contacts.

Route::put( 'contact-type/{id}', 'ContactTypeController@update' );

Here is the controller to test if the request was there with the PUT request.

public function update(Request $request, $id)
{
    return response()->json([ 'id' => $id, 'req' => $request->all() ]);
}

When i send a request using postman, the request is null!

enter image description here

Is the body payload is not allowed in laravel PUT requests? Or how we send additional data in a PUT request?


Solution

Just change from form-data to x-www-form-urlencoded:

Postman body options



Answered By - Beginner
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing