HttpRequest对象常用参数介绍,以及前端不同请求方式(http方法/Content-Type类型)对应的参数获取方式。
一、HttpRequest对象
django请求对象的详细参数以及实现方式可以在django.http.request查看源码具体分析,也可以查看官方文档https://docs.djangoproject.com/en/3.0/ref/request-response/
1.属性介绍
(1) request.scheme
请求的协议种类(http/https)
(2) request.path
请求页面的完整路径(get_full_path()在path的基础上还有查询条件)
(3) request.method