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

Method UnmarshalJSON

config/http_config.go:204–215  ·  view source on GitHub ↗

UnmarshalJSON implements the json.Marshaler interface for URL.

(data []byte)

Source from the content-addressed store, hash-verified

202
203// UnmarshalJSON implements the json.Marshaler interface for URL.
204func (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.
218func (u URL) MarshalJSON() ([]byte, error) {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected