HTTP and Flask Basics - HTTP Requests

HTTP and Flask Basics - HTTP Requests,第1张

HTTP and Flask Basics - HTTP Requests

HTTP requests are sent from the client to the server to initiate some operation. In addition to the URL, HTTP requests have other elements to specify the requested resource.

Elements:

  • Method: Defines the operation to be performed
  • Path: The URL of the resource to be fetched, excluding the scheme and host
  • HTTP Version
  • Headers: optional information, success as Accept-Language
  • Body: optional information, usually for methods such as POST and PATCH, which contain the resource being sent to the server.


Request Methods:
Different request methods indicate different operations to be performed. It’s essential to attend to this to correctly format your requests and properly structure an API.

  • GET: onLY retrieves information for the requested resource of the given URI. Retrieve some information from the backend.
  • POST: Send data to the server to create a new resource
  • PUT: Replaces all of the representation of the target resource with the request data
  • PATCH: Partially modifies the representation of the target resource with the request data
  • DELETE: Removes all of the representation of the resource specified by the URI
  • OPTIONS: Sends the communication options for the requested resource.

Evolution of HTTP

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/zaji/5689245.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-12-17
下一篇 2022-12-17

发表评论

登录后才能评论

评论列表(0条)

保存