Skip to content

Commit 6c31e60

Browse files
mx-psibogdandrutu
authored andcommitted
[confighttp] Remove pointer in CookiesConfig field (open-telemetry#13116)
<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue. Ex. Adding a feature - Explain what this achieves.--> #### Description Removes pointer to `CookiesConfig` field. Since the struct already has an `enabled` field, it is unnecessary for it to be a pointer. This is a breaking change, contrib tests show that it does not affect any contrib component, and it would be hard to do in two steps. <!-- Issue number if applicable --> #### Link to tracking issue Updates open-telemetry#9478
1 parent 0cc0d69 commit 6c31e60

File tree

3 files changed

+28
-3
lines changed

3 files changed

+28
-3
lines changed

.chloggen/mx-psi_cookiesconfig.yaml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Use this changelog template to create an entry for release notes.
2+
3+
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
4+
change_type: breaking
5+
6+
# The name of the component, or a single word describing the area of concern, (e.g. otlpreceiver)
7+
component: confighttp
8+
9+
# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
10+
note: "Remove pointer to field `cookies` in confighttp.ClientConfig"
11+
12+
# One or more tracking issues or pull requests related to the change
13+
issues: [13116]
14+
15+
# (Optional) One or more lines of additional information to render under the primary note.
16+
# These lines will be padded with 2 spaces and then inserted directly into the document.
17+
# Use pipe (|) for multiline entries.
18+
subtext:
19+
20+
# Optional: The change log or logs in which this entry should be included.
21+
# e.g. '[user]' or '[user, api]'
22+
# Include 'user' if the change is relevant to end users.
23+
# Include 'api' if there is a change to a library API.
24+
# Default: '[user]'
25+
change_logs: [api]

config/confighttp/confighttp.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ type ClientConfig struct {
116116
// If not set or set to 0, it defaults to 15s.
117117
HTTP2PingTimeout time.Duration `mapstructure:"http2_ping_timeout,omitempty"`
118118
// Cookies configures the cookie management of the HTTP client.
119-
Cookies *CookiesConfig `mapstructure:"cookies,omitempty"`
119+
Cookies CookiesConfig `mapstructure:"cookies,omitempty"`
120120

121121
// Middlewares are used to add custom functionality to the HTTP client.
122122
// Middleware handlers are called in the order they appear in this list,
@@ -273,7 +273,7 @@ func (hcs *ClientConfig) ToClient(ctx context.Context, host component.Host, sett
273273
}
274274

275275
var jar http.CookieJar
276-
if hcs.Cookies != nil && hcs.Cookies.Enabled {
276+
if hcs.Cookies.Enabled {
277277
jar, err = cookiejar.New(&cookiejar.Options{PublicSuffixList: publicsuffix.List})
278278
if err != nil {
279279
return nil, err

config/confighttp/confighttp_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ func TestAllHTTPClientSettings(t *testing.T) {
9191
IdleConnTimeout: idleConnTimeout,
9292
Compression: "",
9393
DisableKeepAlives: true,
94-
Cookies: &CookiesConfig{Enabled: true},
94+
Cookies: CookiesConfig{Enabled: true},
9595
HTTP2ReadIdleTimeout: idleConnTimeout,
9696
HTTP2PingTimeout: http2PingTimeout,
9797
},

0 commit comments

Comments
 (0)