File tree Expand file tree Collapse file tree
src/main/java/in/erail/route Expand file tree Collapse file tree Original file line number Diff line number Diff 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 {
You can’t perform that action at this time.
0 commit comments