Skip to content

Commit 184932f

Browse files
committed
update review comments
1 parent f0d9dfe commit 184932f

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

.changes/next-release/bugfix-AWSSDKforJavav2-f9f830e.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
"type": "bugfix",
33
"category": "AWS SDK for Java v2",
44
"contributor": "",
5-
"description": "Skip User-Agent header modification in ApplyUserAgentStage when custom User-Agent is already provided."
5+
"description": "ApplyUserAgentStage will not overwrite the custom User-Agent"
66
}

core/sdk-core/src/main/java/software/amazon/awssdk/core/internal/http/pipeline/stages/ApplyUserAgentStage.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public ApplyUserAgentStage(HttpClientDependencies dependencies) {
6868
public SdkHttpFullRequest.Builder execute(SdkHttpFullRequest.Builder request,
6969
RequestExecutionContext context) throws Exception {
7070

71-
if (hasUserAgentInAdditionalHeaders() || hasUserAgentInRequestHeaders(context)) {
71+
if (hasUserAgentInAdditionalHeaders() || hasUserAgentInRequestConfig(context)) {
7272
return request;
7373
}
7474
String headerValue = finalizeUserAgent(context);
@@ -88,10 +88,10 @@ private boolean hasUserAgentInAdditionalHeaders() {
8888
}
8989

9090
/**
91-
* Checks if User-Agent header is present in request-level headers.
91+
* Checks if User-Agent header is present in request override configs.
9292
* We skip adding user-agent in the ApplyUserAgentStage if user has set "User-Agent" header at request level
9393
*/
94-
private boolean hasUserAgentInRequestHeaders(RequestExecutionContext context) {
94+
private boolean hasUserAgentInRequestConfig(RequestExecutionContext context) {
9595
Map<String, List<String>> requestHeaders = context.requestConfig().headers();
9696
if (requestHeaders == null) {
9797
return false;

0 commit comments

Comments
 (0)