Django gets the information in the Header

Today, I need to get some information from the header and check some information. I need to pay attention to the following points:

  1. request.META.get("header key") is used to get header information
  2. Note that the header key must be prefixed with HTTP and capitalized. For example, if your key is username, it should be written as: request.META.get("HTTP_USERNAME")
  3. In addition, when your header key has a dash, it will be automatically converted to an underscore, for example, my-user is written as: request.META.get("HTTP_MY_USER")

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325261419&siteId=291194637