2

Is there is any special security advantages of using a POST request over GET request for delete operation?

As Magento 2 has preferred POST for delete operation.

2 Answers 2

1

As per the CRUD Operations, we use GET request to Read information with the request

You can have a reference here

And for Create or Update Request we use POST Requests

That's why while deletion we use POST or DELETE request.

0

Besides the information already stated, on magento 2 POST and PUT requests are tracked in order to invalidate customer private content sections as can be seen in the file

vendor/magento/module-customer/view/frontend/web/js/section-‌​config.js

$(document).on('submit', function (event) { 
    var sections; 
    if (event.target.method.match(/post|put/i)) { 
        sections = sectionConfig.getAffectedSections(event.target.action);
        if (sections) { 
            customerData.invalidate(sections); 
        } 
    } 
});

see Magento 2: how do customer sections / sections.xml work?

Your Answer

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

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