From 43f0db5d12a3168b4acb3e0fd1add422b00a6758 Mon Sep 17 00:00:00 2001 From: Ben Ye Date: Wed, 12 Jun 2024 15:17:11 -0700 Subject: [PATCH 1/2] set http_headers to be omit empty Signed-off-by: Ben Ye --- config/http_config.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/http_config.go b/config/http_config.go index c89f5864..3e320134 100644 --- a/config/http_config.go +++ b/config/http_config.go @@ -323,7 +323,7 @@ type HTTPClientConfig struct { ProxyConfig `yaml:",inline"` // HTTPHeaders specify headers to inject in the requests. Those headers // could be marshalled back to the users. - HTTPHeaders *Headers `yaml:"http_headers" json:"http_headers"` + HTTPHeaders *Headers `yaml:"http_headers,omitempty" json:"http_headers,omitempty"` } // SetDirectory joins any relative file paths with dir. From c4974e5a1af10e6cfa1b3b93f4a0ab350c9647fa Mon Sep 17 00:00:00 2001 From: Ben Ye Date: Wed, 12 Jun 2024 17:02:22 -0700 Subject: [PATCH 2/2] fix test Signed-off-by: Ben Ye --- config/http_config_test.go | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/config/http_config_test.go b/config/http_config_test.go index 3e7a1269..5be84380 100644 --- a/config/http_config_test.go +++ b/config/http_config_test.go @@ -2023,7 +2023,6 @@ func TestHTTPClientConfig_Marshal(t *testing.T) { proxy_url: "http://localhost:8080" follow_redirects: false enable_http2: false -http_headers: null `, string(actualYAML)) // Unmarshalling the YAML should get the same struct in input. @@ -2040,8 +2039,7 @@ http_headers: null "proxy_url":"http://localhost:8080", "tls_config":{"insecure_skip_verify":false}, "follow_redirects":false, - "enable_http2":false, - "http_headers":null + "enable_http2":false }`, string(actualJSON)) // Unmarshalling the JSON should get the same struct in input.