Skip to content

Commit fd34363

Browse files
committed
Fixed minor bug
1 parent e677cee commit fd34363

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

src/main/java/in/erail/route/OpenAPI3RouteBuilder.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,14 @@ public JsonObject serialiseRoutingContext(RoutingContext pContext) {
103103
if (pContext.request().method() == HttpMethod.POST) {
104104
boolean bodyAsJson = pContext.<Boolean>get(FrameworkConstants.RoutingContext.Attribute.BODY_AS_JSON);
105105
if (bodyAsJson) {
106-
String contentType = pContext.request().headers().get(HttpHeaders.CONTENT_TYPE);
107-
if (!Strings.isNullOrEmpty(contentType) && contentType.equals(MediaType.JSON_UTF_8.toString())) {
106+
String mediaTypeHeader = pContext.request().headers().get(HttpHeaders.CONTENT_TYPE);
107+
MediaType contentType;
108+
if (Strings.isNullOrEmpty(mediaTypeHeader)) {
109+
contentType = MediaType.JSON_UTF_8;
110+
} else {
111+
contentType = MediaType.parse(mediaTypeHeader);
112+
}
113+
if (MediaType.JSON_UTF_8.type().equals(contentType.type()) && MediaType.JSON_UTF_8.subtype().equals(contentType.subtype())) {
108114
result.put(FrameworkConstants.RoutingContext.Json.BODY, pContext.getBodyAsJson());
109115
}
110116
} else {

0 commit comments

Comments
 (0)