Skip to content

Commit 91ce7a3

Browse files
committed
fix(rest): format history length query parameter
This fixes #1197
1 parent 45c6be6 commit 91ce7a3

2 files changed

Lines changed: 3 additions & 2 deletions

File tree

‎client/transport/rest/src/main/java/org/a2aproject/sdk/client/transport/rest/RestTransport.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ public Task getTask(TaskQueryParams taskQueryParams, @Nullable ClientCallContext
141141
try {
142142
StringBuilder url = new StringBuilder(Utils.buildBaseUrl(agentInterface, taskQueryParams.tenant()));
143143
if (taskQueryParams.historyLength() != null && taskQueryParams.historyLength() > 0) {
144-
url.append(String.format("/tasks/%1s?historyLength=%2d", taskQueryParams.id(), taskQueryParams.historyLength()));
144+
url.append(String.format("/tasks/%s?historyLength=%d", taskQueryParams.id(), taskQueryParams.historyLength()));
145145
} else {
146146
url.append(String.format("/tasks/%1s", taskQueryParams.id()));
147147
}

‎client/transport/rest/src/test/java/org/a2aproject/sdk/client/transport/rest/RestTransportTest.java‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,14 +189,15 @@ public void testGetTask() throws Exception {
189189
request()
190190
.withMethod("GET")
191191
.withPath("/tasks/de38c76d-d54c-436c-8b9f-4c2703648d64")
192+
.withQueryStringParameter("historyLength", "5")
192193
)
193194
.respond(
194195
response()
195196
.withStatusCode(200)
196197
.withBody(GET_TASK_TEST_RESPONSE)
197198
);
198199
ClientCallContext context = null;
199-
TaskQueryParams request = new TaskQueryParams("de38c76d-d54c-436c-8b9f-4c2703648d64", 10);
200+
TaskQueryParams request = new TaskQueryParams("de38c76d-d54c-436c-8b9f-4c2703648d64", 5);
200201
RestTransport instance = new RestTransport(CARD);
201202
Task task = instance.getTask(request, context);
202203
assertEquals("de38c76d-d54c-436c-8b9f-4c2703648d64", task.id());

0 commit comments

Comments
 (0)