[management] Omit proxy_protocol from API response when false (#5656)

The internal Target model uses a plain bool for ProxyProtocol,
which was always serialized to the API response as false even
when not configured. Only set the API field when true so it
gets omitted via omitempty when unset.
This commit is contained in:
Viktor Liu
2026-03-24 00:53:17 +08:00
committed by GitHub
parent 17cfa5fe1e
commit 5b85edb753

View File

@@ -262,7 +262,9 @@ func (s *Service) ToAPIResponse() *api.Service {
if opts == nil {
opts = &api.ServiceTargetOptions{}
}
opts.ProxyProtocol = &target.ProxyProtocol
if target.ProxyProtocol {
opts.ProxyProtocol = &target.ProxyProtocol
}
st.Options = opts
apiTargets = append(apiTargets, st)
}