fixed json output for ls-routes and its API and homepage api

This commit is contained in:
yusing
2024-10-15 16:23:46 +08:00
parent f4d532598c
commit 56b778f19c
5 changed files with 23 additions and 12 deletions

View File

@@ -27,8 +27,11 @@ func (u URL) String() string {
return u.URL.String()
}
func (u URL) MarshalText() (text []byte, err error) {
return []byte(u.String()), nil
func (u URL) MarshalJSON() (text []byte, err error) {
if u.URL == nil {
return []byte("null"), nil
}
return []byte("\"" + u.URL.String() + "\""), nil
}
func (u URL) Equals(other *URL) bool {