Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set http_headers to be omit empty #655

Merged
merged 2 commits into from
Jun 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion config/http_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 1 addition & 3 deletions config/http_config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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.
Expand Down