Why does the server receive a GET request even if I performed a POST request?

100 Views Asked by At

I'm trying to create a POST API with Flightphp. I've wrote the following code:

 Flight::route('GET /addProduct', function(){
  echo "GET REQUEST";
 });
 Flight::route('POST /addProduct', function(){
  echo "POST REQUEST";
  var_dump($_POST);
 });

If I perform with Postman a POST request, the output is "GET REQUEST" (and no $_POST variable is printed).

How can I receive a POST request? Why I send a code and the server receives another one?

0

There are 0 best solutions below