MCPcopy Create free account
hub / github.com/prometheus/common / UnmarshalJSON

Method UnmarshalJSON

config/http_config.go:217–228  ·  view source on GitHub ↗

UnmarshalJSON implements the json.Marshaler interface for URL.

(data []byte)

Source from the content-addressed store, hash-verified

215
216// UnmarshalJSON implements the json.Marshaler interface for URL.
217func (u *URL) UnmarshalJSON(data []byte) error {
218 var s string
219 if err := json.Unmarshal(data, &s); err != nil {
220 return err
221 }
222 urlp, err := url.Parse(s)
223 if err != nil {
224 return err
225 }
226 u.URL = urlp
227 return nil
228}
229
230// MarshalJSON implements the json.Marshaler interface for URL.
231func (u URL) MarshalJSON() ([]byte, error) {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected