1 Commits

Author SHA1 Message Date
4f66db0d1b Merge 2e6110e54a into e3cbe1e9b4 2024-11-26 21:30:28 +00:00
2 changed files with 4 additions and 9 deletions

View File

@ -1,7 +1,7 @@
{
"method": "GET",
"url": "https://example.com",
"no_proxy_check": true,
"no_proxy_check": false,
"timeout": 10000,
"dodos_count": 50,
"request_count": 1000,

View File

@ -65,17 +65,12 @@ func (o *option[T]) SetNone() {
}
func (o *option[T]) UnmarshalJSON(data []byte) error {
if string(data) == "null" || len(data) == 0 {
o.SetNone()
if string(data) == "null" {
o.none = true
return nil
}
if err := json.Unmarshal(data, &o.value); err != nil {
o.SetNone()
return err
}
o.none = false
return nil
return json.Unmarshal(data, &o.value)
}
func NewOption[T NonNilT](value T) *option[T] {