Welcome Guest, Not a member yet? Register   Sign In
Why request doesn't work with slash in the end of URL
#1

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?
Reply
#2

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

(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
Reply
#4

Are you by any chance using Postman for testing?
Reply
#5

(This post was last modified: 01-23-2022, 11:54 AM by naghtigall.)

(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?
Reply
#6

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.
Reply
#7

(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!
Reply




Theme © iAndrew 2016 - Forum software by © MyBB