I created a shopware6 plugin which includes a frontend custom route which should be able to receive POST requests from ExactOnline.
But when I make some tests with Postman, I receive "405 Method Not allowed". Here is my controller :
<?php
namespace Emakers\TransmissionPlugin\Controller;
//use Emakers\TransmissionPlugin\Controller\Frontend\Services\ExactRequirements;
use Shopware\Core\Framework\Routing\Annotation\RouteScope;
use Shopware\Core\System\SalesChannel\SalesChannelContext;
use Shopware\Storefront\Controller\StorefrontController;
use Symfony\Component\Routing\Annotation\Route;
/**
* @RouteScope(scopes={"storefront"})
*/
class AccountsController extends StorefrontController
{
/**
* @Route("/accounts", name="frontend.accounts", options={"seo"="false"}, methods={"POST"})
*/
public function accounts()
{
die('ok boy');
$file = 'custom/plugins/TransmissionPlugin/Resources/webhooks/accountWebhook.txt';
}
}
When I replace the methods={"POST"} by methods={"GET"}, the same test request returns "ok boy" which is normal.
I had already created a plugin like this in Shopware5 and GET and POST requests were already working without doing anything special.
How to make POST requests ALLOW in my case on Shopware6?
Thanks !