문제

I am using Magento controller URL with Postman. When I select Get Method in postman then it runs perfectly with execute method. But when I use the Post Method that time it breaks from the execute() method. It means for the Post method, the execute method, not works.

Any idea for this issue? my code is

<?php
namespace Lucent\SocialLogin\Controller\Login;

class Test extends \Magento\Framework\App\Action\Action
{



    protected $_customer;
    protected $_customerSession;

    public function __construct(
    \Magento\Framework\App\Action\Context $context, 
    \Magento\Customer\Model\Customer $customer,
    \Magento\Customer\Model\Session $customerSession
    )
    {

        $this->data = $_REQUEST;
        print_r($this->data);
        $this->_customer = $customer;
        $this->_customerSession = $customerSession;
        return parent::__construct($context);
    }




    public function execute()
    {
        //$postData = $this->getRequest()->getPost();
        //print_r($this->getRequest()->getParam('test'));    
        //print_r($this->data);
        //print_r($postData);
        echo '1';
        die();

    }
}
?>
도움이 되었습니까?

해결책

I got a solution here. When I trying with $.post() method that time no need of form_key.

But, When I trying with var xhttp = new XMLHttpRequest(); with post method then form_key mandatory so that is why $_POST data not getting so quit from it.

Thanks all whoever supports.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 magento.stackexchange
scroll top