mirror of
https://github.com/yusing/godoxy.git
synced 2026-04-23 16:58:31 +02:00
fix(json): ensure valid json
This commit is contained in:
@@ -3,6 +3,7 @@ package nettypes
|
||||
import (
|
||||
urlPkg "net/url"
|
||||
|
||||
"github.com/bytedance/sonic"
|
||||
"github.com/yusing/godoxy/internal/utils"
|
||||
)
|
||||
|
||||
@@ -48,7 +49,7 @@ func (u *URL) MarshalJSON() (text []byte, err error) {
|
||||
if u == nil {
|
||||
return []byte("null"), nil
|
||||
}
|
||||
return []byte("\"" + u.URL.String() + "\""), nil
|
||||
return sonic.Marshal(u.URL.String())
|
||||
}
|
||||
|
||||
func (u *URL) Equals(other *URL) bool {
|
||||
|
||||
Reference in New Issue
Block a user