HttpServletRequest req 接口文档入参怎么写
时间: 2023-08-07 12:40:04 浏览: 49
通常情况下,接口文档的入参应该包含以下内容:
1. 请求方式:GET、POST等。
2. 接口路径:例如:/user/login。
3. 请求参数:包括必传参数和可选参数,每个参数需要说明参数名、类型、是否必传、描述等。
4. 请求头:如果有请求头,需要说明每个请求头的键名、类型、是否必传、描述等。
5. 示例:提供一个请求示例,包括请求方式、路径、请求参数、请求头等。
对于HttpServletRequest req这种情况,应该在请求参数中说明该参数的类型是HttpServletRequest类型,同时需要说明该参数是否必传、描述等。例如:
```
请求方式:POST
接口路径:/user/update
请求参数:
{
"req": {
"type": "HttpServletRequest",
"required": true,
"description": "HTTP请求对象"
},
"username": {
"type": "string",
"required": true,
"description": "用户名"
},
"password": {
"type": "string",
"required": true,
"description": "密码"
}
}
请求示例:
POST /user/update HTTP/1.1
Content-Type: application/json
{
"req": {},
"username": "admin",
"password": "123456"
}
```