-
Notifications
You must be signed in to change notification settings - Fork 173
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
feat(web): add ability to skip X-SPINNAKER-ACCOUNTS in SpinnakerRequestInterceptor and SpinnakerRequestHeaderInterceptor #1148
Changes from all commits
903e6d3
8538173
2558471
96bbc7b
8f17dfe
5db0f8d
4e311e7
f6ffeb9
14dce34
52c5781
d2f3677
1cdeef8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -119,5 +119,3 @@ interface Retrofit1Service { | |
fun getSomething(@Path("user") user: String?, callback: Callback<List<*>?>?) | ||
|
||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -82,12 +82,12 @@ public class OkHttpClientComponents { | |
|
||
@Bean | ||
public SpinnakerRequestInterceptor spinnakerRequestInterceptor() { | ||
return new SpinnakerRequestInterceptor(clientProperties); | ||
return new SpinnakerRequestInterceptor(clientProperties.getPropagateSpinnakerHeaders()); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There seems to be no way to configure sending the account headers? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Right....sort of. The SpinnakerRequestInterceptor bean keeps the same behavior -- to send the account headers. But now it's possible to construct another SpinnakerRequestInterceptor bean that doesn't. |
||
} | ||
|
||
@Bean | ||
public SpinnakerRequestHeaderInterceptor spinnakerRequestHeaderInterceptor() { | ||
return new SpinnakerRequestHeaderInterceptor(clientProperties); | ||
return new SpinnakerRequestHeaderInterceptor(clientProperties.getPropagateSpinnakerHeaders()); | ||
} | ||
|
||
@Bean | ||
|
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
/* | ||
* Copyright 2024 Salesforce, Inc. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License") | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package com.netflix.spinnaker.config; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
import com.netflix.spinnaker.okhttp.OkHttp3MetricsInterceptor; | ||
import com.netflix.spinnaker.okhttp.OkHttpMetricsInterceptor; | ||
import com.netflix.spinnaker.okhttp.SpinnakerRequestHeaderInterceptor; | ||
import com.netflix.spinnaker.okhttp.SpinnakerRequestInterceptor; | ||
import org.junit.jupiter.api.BeforeEach; | ||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.TestInfo; | ||
import org.springframework.boot.context.annotation.UserConfigurations; | ||
import org.springframework.boot.task.TaskExecutorBuilder; | ||
import org.springframework.boot.test.context.runner.ApplicationContextRunner; | ||
|
||
class OkHttpClientComponentsTest { | ||
|
||
private final ApplicationContextRunner runner = | ||
new ApplicationContextRunner() | ||
.withBean(TaskExecutorBuilder.class) | ||
.withConfiguration(UserConfigurations.of(OkHttpClientComponents.class)); | ||
|
||
@BeforeEach | ||
void init(TestInfo testInfo) { | ||
System.out.println("--------------- Test " + testInfo.getDisplayName()); | ||
} | ||
|
||
@Test | ||
void verifyValidConfiguration() { | ||
runner.run( | ||
ctx -> { | ||
assertThat(ctx).hasSingleBean(SpinnakerRequestInterceptor.class); | ||
assertThat(ctx).hasSingleBean(SpinnakerRequestHeaderInterceptor.class); | ||
assertThat(ctx).hasSingleBean(OkHttpMetricsInterceptor.class); | ||
assertThat(ctx).hasSingleBean(OkHttp3MetricsInterceptor.class); | ||
}); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is one thing I really dislike about the HTTP spec is that they don't define a limit for header size, so servers just arbitrarily choose one. One thing we can do is also only send the header if the size is manageable (whatever that may be). So rather than needing to configure this, it can just send this header when the header values is less than 8kb or something which should work on most servers.