| Current Path : /var/www/www.indacotrentino.com/www/app/code/Webkul/BuyButton/Plugin/ |
| Current File : //var/www/www.indacotrentino.com/www/app/code/Webkul/BuyButton/Plugin/CorsAllowedMethodPlugin.php |
<?php
/**
* Webkul Software.
*
* @category Webkul
* @package Webkul_BuyButton
* @author Webkul
* @copyright Copyright (c) Webkul Software Private Limited (https://webkul.com)
* @license https://store.webkul.com/license.html
*/
namespace Webkul\BuyButton\Plugin;
use Magento\Framework\Webapi\Request;
class CorsAllowedMethodPlugin
{
/**
* allow pre-flight request method
*
* @param Request $subject
* @return void
*/
public function aroundGetHttpMethod(
Request $subject
) {
if (!$subject->isGet() && !$subject->isPost() &&
!$subject->isPut() && !$subject->isDelete() && !$subject->isOptions()) {
throw new \Magento\Framework\Exception\InputException(new Phrase('Request method is invalid.'));
}
return $subject->getMethod();
}
}