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.
Magento Stack Exchange is a question and answer site for users of the Magento e-Commerce platform. It only takes a minute to sign up.
Sign up to join this communityAs 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.
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?