Skip to content

Commit 98263eb

Browse files
committed
fix format
1 parent 34d0358 commit 98263eb

File tree

1 file changed

+17
-13
lines changed

1 file changed

+17
-13
lines changed

mcp/src/main/java/io/modelcontextprotocol/client/transport/StreamableHttpClientTransport.java

+17-13
Original file line numberDiff line numberDiff line change
@@ -289,9 +289,9 @@ private Mono<Void> handleSingleJson(final HttpResponse<InputStream> response,
289289
final Function<Mono<McpSchema.JSONRPCMessage>, Mono<McpSchema.JSONRPCMessage>> handler) {
290290
return Mono.fromCallable(() -> {
291291
try {
292-
final McpSchema.JSONRPCMessage msg = McpSchema.deserializeJsonRpcMessage(objectMapper,
293-
new String(response.body().readAllBytes(), StandardCharsets.UTF_8));
294-
return handler.apply(Mono.just(msg));
292+
final McpSchema.JSONRPCMessage msg = McpSchema.deserializeJsonRpcMessage(objectMapper,
293+
new String(response.body().readAllBytes(), StandardCharsets.UTF_8));
294+
return handler.apply(Mono.just(msg));
295295
}
296296
catch (IOException e) {
297297
LOGGER.error("Error processing JSON response", e);
@@ -349,26 +349,30 @@ else if (line.startsWith("id: "))
349349
for (JsonNode item : node) {
350350
messages.add(McpSchema.deserializeJsonRpcMessage(objectMapper, item.toString()));
351351
}
352-
} else if (node.isObject()) {
352+
}
353+
else if (node.isObject()) {
353354
messages.add(McpSchema.deserializeJsonRpcMessage(objectMapper, node.toString()));
354-
} else {
355+
}
356+
else {
355357
String warning = "Unexpected JSON in SSE data: " + rawData;
356358
LOGGER.warn("Unexpected JSON in SSE data: {}", rawData);
357359
return Mono.error(new IllegalArgumentException(warning));
358360
}
359361

360362
return Flux.fromIterable(messages)
361-
.concatMap(msg -> handler.apply(Mono.just(msg)))
362-
.then(Mono.fromRunnable(() -> {
363-
if (!sseEvent.id().isEmpty()) {
364-
lastEventId.set(sseEvent.id());
365-
}
366-
}));
367-
} catch (IOException e) {
363+
.concatMap(msg -> handler.apply(Mono.just(msg)))
364+
.then(Mono.fromRunnable(() -> {
365+
if (!sseEvent.id().isEmpty()) {
366+
lastEventId.set(sseEvent.id());
367+
}
368+
}));
369+
}
370+
catch (IOException e) {
368371
LOGGER.error("Error parsing SSE JSON: {}", rawData, e);
369372
return Mono.error(e);
370373
}
371-
}).then();
374+
})
375+
.then();
372376
}
373377

374378
@Override

0 commit comments

Comments
 (0)