Why POST Request from POSTMAN returns empty?

11,276

DUDE! I finally realize your parameters is wrong

"number": ""123"" you put 2 double quote it should "number": "123"

Share:
11,276
Success Man
Author by

Success Man

Updated on June 08, 2022

Comments

  • Success Man
    Success Man almost 2 years

    My header in the postman like this :

    enter image description here

    My body like this :

    enter image description here

    In the routes laravel lumen, I check like this :

    $router->group(['middleware' => 'auth'], function ($router) {
        ...
        $router->post('/sales-order', function (\Illuminate\Http\Request $request)
        {
            echo '<pre>';print_r($request->all());echo '</pre>';die();
        });
    });
    

    The result in the postman return empty array like this :

    enter image description here

    How can I solve the error?

  • moses toh
    moses toh over 5 years
    It works. But this : postimg.cc/image/dt5ihpoh3. Which I mark, it becomes text. No json
  • Beginner
    Beginner over 5 years
    then modify your backend
  • moses toh
    moses toh over 5 years
    Okay. But I see here : laracasts.com/discuss/channels/general-discussion/…. It can use json and works. But why my postman is not works?
  • Beginner
    Beginner over 5 years
    whats the result anyway? screen shot it, seems the problem is in your backend
  • Beginner
    Beginner over 5 years
    @SuccessMan try this stackoverflow.com/a/21219626/3481654 Input::all(); or $request->json()->all();
  • Beginner
    Beginner over 5 years
    try $request->json()->all(); this then make it json again
  • moses toh
    moses toh over 5 years
    If use Input:all();, it's the same
  • Beginner
    Beginner over 5 years
    did you make it json again?
  • moses toh
    moses toh over 5 years
    It does not work. If use Content-Type application/json the result empty
  • Beginner
    Beginner over 5 years
    @SuccessMan at the beginning your code is just okay, its just you put an invalid json parameter just look at the postman there's a x mark which mean that format is incorrect and still it can display only by text
  • moses toh
    moses toh over 5 years
    Great. I really don't see that. But thanks a lot. It works. Have a nice day :)