mirror of
https://github.com/floci-io/floci.git
synced 2026-11-23 06:00:46 -05:00
fix(stepfunctions): override HTTP task user agent (#5995)
This commit is contained in:
1 parent
a103b938d2
commit
0a510d3510
2 files changed
+7
-2
No files matched your search
@@ -357,7 +357,6 @@ public class AslExecutor {
|
||||
: EXPRESS_MAX_EXECUTION_TIME;
|
||||
if (vertx != null) {
|
||||
// This can be optimized further
|
||||
// TODO Set WebclientOptions useragent to Amazon|StepFunctions|HttpInvoke|{{{{region}}}}
|
||||
this.webClient = WebClient.wrap(vertx.createHttpClient());
|
||||
} else {
|
||||
webClient = null;
|
||||
@@ -4792,7 +4791,8 @@ public class AslExecutor {
|
||||
try {
|
||||
HttpRequest<Buffer> request = webClient.requestAbs(HttpMethod.valueOf(method), rawUri)
|
||||
.timeout(timeoutMillis)
|
||||
.putHeaders(requestHeaders);
|
||||
.putHeaders(requestHeaders)
|
||||
.putHeader("User-Agent", "Amazon|StepFunctions|HttpInvoke|" + region);
|
||||
request.queryParams().addAll(requestQueryParameters);
|
||||
|
||||
LOG.infov("Step Functions HTTP task sending request: method={0}, uri={1}", method, uri);
|
||||
|
||||
+5
@@ -219,6 +219,7 @@ class AslExecutorHttpInvokeTest {
|
||||
|
||||
assertFalse(request.query().contains("ignored"));
|
||||
assertEquals(List.of("one", "two"), request.headerValues("X-Custom"));
|
||||
assertEquals(List.of("Amazon|StepFunctions|HttpInvoke|" + REGION), request.headerValues("User-Agent"));
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -236,6 +237,9 @@ class AslExecutorHttpInvokeTest {
|
||||
"Authentication": {
|
||||
"ConnectionArn": "%s"
|
||||
},
|
||||
"Headers": {
|
||||
"User-Agent": "custom-client/1.0"
|
||||
},
|
||||
"RequestBody": {
|
||||
"customerId.$": "$.customerId",
|
||||
"active": true
|
||||
@@ -259,6 +263,7 @@ class AslExecutorHttpInvokeTest {
|
||||
|
||||
RecordedRequest request = onlyRequest();
|
||||
assertEquals("POST", request.method());
|
||||
assertEquals(List.of("Amazon|StepFunctions|HttpInvoke|" + REGION), request.headerValues("User-Agent"));
|
||||
assertEquals("application/json", request.firstHeader("Content-Type"));
|
||||
JsonNode body = objectMapper.readTree(request.body());
|
||||
assertEquals("cust-123", body.path("customerId").asText());
|
||||
|
||||
Reference in new issue
Block a user