UnmarshalJSON implements the json.Marshaler interface for URL.
(data []byte)
| 202 | |
| 203 | // UnmarshalJSON implements the json.Marshaler interface for URL. |
| 204 | func (u *URL) UnmarshalJSON(data []byte) error { |
| 205 | var s string |
| 206 | if err := json.Unmarshal(data, &s); err != nil { |
| 207 | return err |
| 208 | } |
| 209 | urlp, err := url.Parse(s) |
| 210 | if err != nil { |
| 211 | return err |
| 212 | } |
| 213 | u.URL = urlp |
| 214 | return nil |
| 215 | } |
| 216 | |
| 217 | // MarshalJSON implements the json.Marshaler interface for URL. |
| 218 | func (u URL) MarshalJSON() ([]byte, error) { |
nothing calls this directly
no outgoing calls
no test coverage detected