From b99998bc85caa3e1e7042e877820c01945728f38 Mon Sep 17 00:00:00 2001 From: Guillaume Grossetie Date: Thu, 12 Oct 2023 15:59:52 +0200 Subject: [PATCH] Revert getBodyAsString changes (unrelated and we need to update mock) --- .../src/main/java/io/kroki/server/service/DiagramHandler.java | 4 ++-- server/src/main/java/io/kroki/server/service/DiagramRest.java | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/server/src/main/java/io/kroki/server/service/DiagramHandler.java b/server/src/main/java/io/kroki/server/service/DiagramHandler.java index 8a3b7cfeb..22e6f7d39 100644 --- a/server/src/main/java/io/kroki/server/service/DiagramHandler.java +++ b/server/src/main/java/io/kroki/server/service/DiagramHandler.java @@ -83,7 +83,7 @@ public Handler createPost(String serviceName) { JsonObject jsonBody; MIMEHeader contentType = routingContext.parsedHeaders().contentType(); if (contentType != null && contentType.value() != null && contentType.value().equals("application/json")) { - String bodyAsString = routingContext.body().asString(); + String bodyAsString = routingContext.getBodyAsString(); if (bodyAsString == null || bodyAsString.trim().isEmpty()) { routingContext.fail(new BadRequestException("Request body must not be empty.")); return; @@ -98,7 +98,7 @@ public Handler createPost(String serviceName) { } else { // assumes that the Content-Type is "plain/text" (default) jsonBody = new JsonObject(); - diagramSource = routingContext.body().asString(); + diagramSource = routingContext.getBodyAsString(); if (diagramSource == null || diagramSource.trim().isEmpty()) { routingContext.fail(new BadRequestException("Request body must not be empty.")); return; diff --git a/server/src/main/java/io/kroki/server/service/DiagramRest.java b/server/src/main/java/io/kroki/server/service/DiagramRest.java index c5a4e1aaf..bb3cf7ac0 100644 --- a/server/src/main/java/io/kroki/server/service/DiagramRest.java +++ b/server/src/main/java/io/kroki/server/service/DiagramRest.java @@ -20,7 +20,7 @@ public DiagramRest(DiagramRegistry registry) { public Handler create() { return routingContext -> { - String bodyAsString = routingContext.body().asString(); + String bodyAsString = routingContext.getBodyAsString(); if (bodyAsString == null || bodyAsString.trim().isEmpty()) { routingContext.fail(new BadRequestException("Request body must not be empty.")); return;