Skip to content

Commit 3961897

Browse files
committed
Fix build
1 parent 9ab50f7 commit 3961897

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/internal/testutils/AwsProxyRequestBuilder.java

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -193,18 +193,20 @@ public AwsProxyRequestBuilder queryString(String key, String value) {
193193
}
194194
// ALB does not decode parameters automatically like API Gateway.
195195
if (request.getRequestSource() == AwsProxyRequest.RequestSource.ALB) {
196-
String albValue = value;
197196
try {
198197
//if (URLDecoder.decode(value, ContainerConfig.DEFAULT_CONTENT_CHARSET).equals(value)) {
199198
// TODO: Assume we are always given an unencoded value, smarter check here to encode
200199
// only if necessary
201-
albValue = URLEncoder.encode(value, ContainerConfig.DEFAULT_CONTENT_CHARSET);
200+
this.request.getMultiValueQueryStringParameters().add(
201+
key,
202+
URLEncoder.encode(value, ContainerConfig.DEFAULT_CONTENT_CHARSET)
203+
);
202204
//}
203205
} catch (UnsupportedEncodingException e) {
204206
e.printStackTrace();
205207
throw new RuntimeException(e);
206208
}
207-
this.request.getMultiValueQueryStringParameters().add(key, albValue);
209+
208210
}
209211
return this;
210212
}
@@ -252,7 +254,16 @@ public AwsProxyRequestBuilder authorizerPrincipal(String principal) {
252254
}
253255
if (this.request.getRequestSource() == AwsProxyRequest.RequestSource.ALB) {
254256
header("x-amzn-oidc-identity", principal);
255-
header("x-amzn-oidc-accesstoken", Base64.getMimeEncoder().encodeToString("test-token".getBytes()));
257+
try {
258+
header(
259+
"x-amzn-oidc-accesstoken",
260+
Base64.getMimeEncoder().encodeToString(
261+
"test-token".getBytes(ContainerConfig.DEFAULT_CONTENT_CHARSET)
262+
)
263+
);
264+
} catch (UnsupportedEncodingException e) {
265+
throw new RuntimeException(e);
266+
}
256267
}
257268
return this;
258269
}

0 commit comments

Comments
 (0)