0

Is it safe to not implement HttpPostActionInterface ?

From:

class NewAction extends SubscriberController implements HttpPostActionInterface

To:

class NewAction extends SubscriberController

My goal on removing the implement HttpPostActionInterface was to prevent the page on displaying the 404 page if no post was sent. Our requirement was only to display a blank page when user manually load the link.

Or if you have other option on displaying blank page instead displaying 404 not found content.

Other Classes connected/extended that might help:

SubscriberController

abstract class Subscriber extends \Magento\Framework\App\Action\Action

\Magento\Framework\App\Action\Action

abstract class Action extends AbstractAction

AbstractAction

abstract class AbstractAction implements \Magento\Framework\App\ActionInterface

1 Answer 1

1

Your Controller Must Implement POST or GET Action Interface Class Other wise it will give you 404 No Found to your request

if your controller SubscriberController is implement any of ActionInterface its okay you don't need to implement that again

Update

The Class \Magento\Framework\App\Action\Action can be used but it is depreciated after Magneto 2.4 so it's a good practice to implement PostActionInterface

3
  • Hello thank you for the reply, the SubscriberController doesn't implement it, but it extends \Magento\Framework\App\Action\Action . Is it okay ? Commented Oct 7, 2021 at 9:05
  • I updated also my question, can you check if it still need to implement the HttpPostActionInterface or is it okay not ? Commented Oct 7, 2021 at 9:16
  • 1
    check my updated answer
    – Waqar Ali
    Commented Oct 7, 2021 at 11:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.