I'm setting up a REST-server in PHP and want to allow the client to use an endpoint with different methods like GET, POST, PUT, DELETE, ... But there is a problem when I try adding the function for the POST method: The application runs the function for GET if I try to access it with POST via Postman.
I already tried to comment the GET function but if I do this, I get an error 405.
// Just a testing function for POST
$app->post('/users', function (Request $request, Response $response, array $args)
{
$user = $request->getParsedBody();
$response->getBody()->write(json_encode($user->getWrapperClass()));
return $response->withHeader('Content-Type', 'application/json');
});
Anyone can help me?