Hello,

I am having some issue marshaling and unmarshalling a HTTPClientConfig 
struct to JSON.
https://github.com/prometheus/common/blob/49b36038aead362ce78f09337dc5872000bd048a/config/http_config.go#L239

The problem is about the ProxyURL field. When there are no ProxyURL 
configured,it gets marshaled to "proxy_url":null, and then it gets 
unmarshaled to an empty string.

Contrary to a null pointer, an empty string will be handled by the http 
package like a valid Proxy. resulting in some connection error.
https://pkg.go.dev/net/http#Transport

I first thought that it was some kind of bug, but then looking at the 
tests, this looks like an intended feature:
https://github.com/prometheus/common/blob/49b36038aead362ce78f09337dc5872000bd048a/config/http_config_test.go#L1435

This is why I am confused here, is it a bug, or is there some kind of trick 
that I am missing?

Thanks,

-- 
You received this message because you are subscribed to the Google Groups 
"Prometheus Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/prometheus-developers/ace6dd1e-2f5f-47b7-bea0-00f182859210n%40googlegroups.com.

Reply via email to