feat: 支持自定义请求 Header

This commit is contained in:
Mmx233
2023-12-03 20:38:27 +08:00
parent 59bf13467b
commit 6badcf8d08
2 changed files with 9 additions and 5 deletions

View File

@@ -1,6 +1,7 @@
package config
import (
"bytes"
"encoding/json"
log "github.com/sirupsen/logrus"
"gopkg.in/yaml.v3"
@@ -31,7 +32,9 @@ func (Json) Marshal(v any) ([]byte, error) {
return json.MarshalIndent(v, "", " ")
}
func (Json) Unmarshal(data []byte, v any) error {
return json.Unmarshal(data, v)
jsonDecoder := json.NewDecoder(bytes.NewReader(data))
jsonDecoder.UseNumber()
return jsonDecoder.Decode(v)
}
type Yaml struct {