Why do we need anything more than HTTP GET, PUT, POST?

后端 未结 14 766
-上瘾入骨i
-上瘾入骨i 2021-02-04 10:09

What is the practical benefit of using HTTP GET, PUT, DELETE, POST, HEAD? Why not focus on their behavioral benefits (safety and idempotency), forgetting their names, and use GE

14条回答
  •  一向
    一向 (楼主)
    2021-02-04 10:38

    Why do we need more than POST? It allows data to flow both ways, so why would GET be needed? The answer is basically the same as for your question. By standardizing the basic expectations of the various methods other processes can better know what to do.

    For example, intervening caching proxies can have a better chance of doing the correct thing.

    Think about HEAD for instance. If the proxy server knows what HEAD means then it can process the result from a previous GET request to provide the proper answer to a HEAD request. And it can know that POST, PUT and DELETE should not be cached.

提交回复
热议问题