Are the PUT, DELETE, HEAD, etc methods available in most web browsers?

前端 未结 7 1191
夕颜
夕颜 2020-11-21 06:46

I\'ve seen a couple questions around here like How to debug RESTful services, which mentions:

Unfortunately that same browser won\'t allow me to test

7条回答
  •  清酒与你
    2020-11-21 07:02

    _method hidden field workaround

    Used in Rails and could be adapted to any framework:

    • add a hidden _method parameter to any form that is not GET or POST:

      
      

      This can be done automatically in frameworks through the HTML creation helper method (e.g. Rails form_tag)

    • fix the actual form method to POST (

      )

    • processes _method on the server and do exactly as if that method had been sent instead of the actual POST

    Rationale / history of why it is not possible: https://softwareengineering.stackexchange.com/questions/114156/why-there-are-no-put-and-delete-methods-in-html-forms

提交回复
热议问题