When should I use GET or POST method? What's the difference between them?

后端 未结 14 1787
-上瘾入骨i
-上瘾入骨i 2020-11-21 06:44

What\'s the difference when using GET or POST method? Which one is more secure? What are (dis)advantages of each of them?

(similar question

14条回答
  •  时光取名叫无心
    2020-11-21 07:33

    This W3C document explains the use of HTTP GET and POST.

    I think it is an authoritative source.

    The summary is (section 1.3 of the document):

    • Use GET if the interaction is more like a question (i.e., it is a safe operation such as a query, read operation, or lookup).
    • Use POST if:
      • The interaction is more like an order, or
      • The interaction changes the state of the resource in a way that the user would perceive (e.g., a subscription to a service), or
      • The user be held accountable for the results of the interaction.

提交回复
热议问题