CodeIgniter Forums
Why request doesn't work with slash in the end of URL - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24)
+--- Thread: Why request doesn't work with slash in the end of URL (/showthread.php?tid=81074)



Why request doesn't work with slash in the end of URL - naghtigall - 01-21-2022

In Controller I have this method:

Code:
public function webhook()
    {
        $request = \Config\Services::request();

        $hook_request = $request->getJSON();
        var_dump($hook_request);
        }

if I send request like http://localhost/controller/webhook - this works
If I send http://localhost/controller/webhook/ it's not worked
What is wrong?


RE: Why request doesn't work with slash in the end of URL - kenjis - 01-21-2022

What do you mean by "it's not worked"?
What happened?


RE: Why request doesn't work with slash in the end of URL - naghtigall - 01-21-2022

(01-21-2022, 04:34 AM)kenjis Wrote: What do you mean by "it's not worked"?
What happened?
I send POST data.
when add slash in the end URL returns NULL


RE: Why request doesn't work with slash in the end of URL - iRedds - 01-21-2022

Are you by any chance using Postman for testing?


RE: Why request doesn't work with slash in the end of URL - naghtigall - 01-23-2022

(01-21-2022, 11:04 AM)iRedds Wrote: Are you by any chance using Postman for testing?
Yes, I use postman for testing API.
Is it reason of my problem?


RE: Why request doesn't work with slash in the end of URL - iRedds - 01-23-2022

He has such a bug when, depending on the presence or absence of a slash, he (I don’t remember exactly) either does not send data or uses the GET method instead of POST.


RE: Why request doesn't work with slash in the end of URL - naghtigall - 01-24-2022

(01-23-2022, 12:52 PM)iRedds Wrote: He has such a bug when, depending on the presence or absence of a slash, he (I don’t remember exactly) either does not send data or uses the GET method instead of POST.
Thank you!