请求类型枚举值定义
This commit is contained in:
parent
1f5050978f
commit
325efde765
38
enums/data_location.go
Normal file
38
enums/data_location.go
Normal file
@ -0,0 +1,38 @@
|
||||
// Package enums ...
|
||||
//
|
||||
// Description : enums ...
|
||||
//
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 2024-11-25 14:39
|
||||
package enums
|
||||
|
||||
// RequestDataLocation 请求数据所在位置
|
||||
//
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 14:40 2024/11/25
|
||||
type RequestDataLocation string
|
||||
|
||||
func (rdl RequestDataLocation) String() string {
|
||||
return string(rdl)
|
||||
}
|
||||
|
||||
func (rdl RequestDataLocation) MarshalJSON() ([]byte, error) {
|
||||
return []byte(rdl.String()), nil
|
||||
}
|
||||
|
||||
// ResponseDataLocation 响应数据所在位置
|
||||
//
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 14:41 2024/11/25
|
||||
type ResponseDataLocation string
|
||||
|
||||
func (rdl ResponseDataLocation) String() string {
|
||||
return string(rdl)
|
||||
}
|
||||
|
||||
func (rdl ResponseDataLocation) MarshalJSON() ([]byte, error) {
|
||||
return []byte(rdl.String()), nil
|
||||
}
|
39
request.go
39
request.go
@ -7,30 +7,37 @@
|
||||
// Date : 2024-04-22 11:04
|
||||
package consts
|
||||
|
||||
import "git.zhangdeman.cn/zhangdeman/consts/enums"
|
||||
|
||||
const (
|
||||
RequestDataLocationHeader = "HEADER" // header
|
||||
RequestDataLocationCookie = "COOKIE" // cookie
|
||||
RequestDataLocationBody = "BODY" // body
|
||||
RequestDataLocationQuery = "QUERY" // query
|
||||
RequestDataLocationUriPath = "URI_PATH" // uri路由一部分
|
||||
RequestDataLocationStatic = "STATIC" // 静态配置的参数
|
||||
RequestDataLocationCustomConfig = "CUSTOM_CONFIG" // 针对接口的一些自定义配置规则
|
||||
RequestDataLocationHeader enums.RequestDataLocation = "HEADER" // header
|
||||
RequestDataLocationCookie enums.RequestDataLocation = "COOKIE" // cookie
|
||||
RequestDataLocationBody enums.RequestDataLocation = "BODY" // body
|
||||
RequestDataLocationQuery enums.RequestDataLocation = "QUERY" // query
|
||||
RequestDataLocationUriPath enums.RequestDataLocation = "URI_PATH" // uri路由一部分
|
||||
RequestDataLocationStatic enums.RequestDataLocation = "STATIC" // 静态配置的参数
|
||||
RequestDataLocationCustomConfig enums.RequestDataLocation = "CUSTOM_CONFIG" // 针对接口的一些自定义配置规则
|
||||
)
|
||||
|
||||
const (
|
||||
ResponseDataLocationHeader = "HEADER" // header
|
||||
ResponseDataLocationCookie = "COOKIE" // cookie
|
||||
ResponseDataLocationBody = "BODY" // body
|
||||
ResponseDataLocationExtension = "EXTENSION" // 扩展信息
|
||||
ResponseDataLocationHeader enums.ResponseDataLocation = "HEADER" // header
|
||||
ResponseDataLocationCookie enums.ResponseDataLocation = "COOKIE" // cookie
|
||||
ResponseDataLocationBody enums.ResponseDataLocation = "BODY" // body
|
||||
ResponseDataLocationExtension enums.ResponseDataLocation = "EXTENSION" // 扩展信息
|
||||
)
|
||||
|
||||
type DataLocationDesc struct {
|
||||
Value string `json:"value"` // 数据位置
|
||||
Description string `json:"description"` // 数据位置描述
|
||||
type RequestDataLocationDesc struct {
|
||||
Value enums.RequestDataLocation `json:"value"` // 数据位置
|
||||
Description string `json:"description"` // 数据位置描述
|
||||
}
|
||||
|
||||
type ResponseDataLocationDesc struct {
|
||||
Value enums.ResponseDataLocation `json:"value"` // 数据位置
|
||||
Description string `json:"description"` // 数据位置描述
|
||||
}
|
||||
|
||||
var (
|
||||
RequestDataLocationList = []DataLocationDesc{
|
||||
RequestDataLocationList = []RequestDataLocationDesc{
|
||||
{Value: RequestDataLocationHeader, Description: "请求header"},
|
||||
{Value: RequestDataLocationCookie, Description: "请求cookie"},
|
||||
{Value: RequestDataLocationBody, Description: "请求body"},
|
||||
@ -39,7 +46,7 @@ var (
|
||||
{Value: RequestDataLocationStatic, Description: "静态参数配置"},
|
||||
{Value: RequestDataLocationCustomConfig, Description: "自定义接口处理规则"},
|
||||
}
|
||||
ResponseDataLocationList = []DataLocationDesc{
|
||||
ResponseDataLocationList = []ResponseDataLocationDesc{
|
||||
{Value: ResponseDataLocationHeader, Description: "响应header"},
|
||||
{Value: ResponseDataLocationCookie, Description: "响应cookie"},
|
||||
{Value: ResponseDataLocationBody, Description: "响应body"},
|
||||
|
Loading…
Reference in New Issue
Block a user