Just started learning Slim3
. Have been spending some time figuring out how to perform redirects with overriding original request type with no success.
I want the /origin
route to perform the redirect to /dest
route.
/origin
route receives GET
request performs validation and after success redirects with POST
request to /dest
uri route. Here is the screenshot. I think I am doing something dumb here:
$app->get('/origin', function($req,$res,$args)
{
$req= $req->withHeader('X-Http-Method-Override','POST');
return $res->withRedirect('/dest');
});
$app->post('/dest', function($req,$res,$args)
{
echo "this is destination page";
});