When calling a url with a 'Get' request, I'm able to get a response just fine.
However, when I'm calling the same url with a 'Post' request, I get a 'bad request'. Any suggestions/ideas on why this may be happening?
Code in the index.php file:
//GET Request: This works fine!
$app->get('/api/ss20/registration/?', function () use ($app) {
echo "hello-get";
});
//POST Request: This gives a bad request error!
$app->post('/api/ss20/registration/?', function () use ($app) {
echo "hello-post";
});
The simple form I'm using to make the get request:
<form action="api/ss20/registration/" method="get">
First name: <input type="text" name="fname"><br>
Last name: <input type="text" name="lname"><br>
<input type="submit" value="Submit">
</form>
The simple form I'm using to make the post request:
<form action="api/ss20/registration/" method="post">
First name: <input type="text" name="fname"><br>
Last name: <input type="text" name="lname"><br>
<input type="submit" value="Submit">
</form>
Tried using postman / Arc to simulate the requests. And the get requests work fine, but not posts.