修复相关BUG + 增加单元测试, 覆盖率100%

This commit is contained in:
2025-04-20 17:57:01 +08:00
parent 299edfcc9a
commit fb1d6bb34f
19 changed files with 669 additions and 134 deletions

View File

@ -19,43 +19,19 @@ func (rdl RequestDataLocation) String() string {
}
func (rdl RequestDataLocation) MarshalJSON() ([]byte, error) {
return []byte(rdl.String()), nil
return []byte(`"` + rdl.String() + `"`), nil
}
func (rdl RequestDataLocation) IsValid() bool {
for _, item := range RequestDataLocationList {
if item.Value == rdl {
if item.Value == rdl || item.Value.String() == rdl.String() {
return true
}
}
return false
}
// 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
}
func (rdl *ResponseDataLocation) IsValid() bool {
for _, item := range ResponseDataLocationList {
if item.Value == *rdl {
return true
}
}
return false
}
var (
const (
RequestDataLocationHeader RequestDataLocation = "HEADER" // header
RequestDataLocationCookie RequestDataLocation = "COOKIE" // cookie
RequestDataLocationBody RequestDataLocation = "BODY" // body
@ -66,7 +42,31 @@ var (
RequestDataLocationCustomConfig RequestDataLocation = "CUSTOM_CONFIG" // 针对接口的一些自定义配置规则
)
var (
// 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
}
func (rdl ResponseDataLocation) IsValid() bool {
for _, item := range ResponseDataLocationList {
if item.Value == rdl || item.Value.String() == rdl.String() {
return true
}
}
return false
}
const (
ResponseDataLocationHeader ResponseDataLocation = "HEADER" // header
ResponseDataLocationCookie ResponseDataLocation = "COOKIE" // cookie
ResponseDataLocationBody ResponseDataLocation = "BODY" // body