diff --git a/src/main/java/org/heigit/bigspatialdata/ohsome/ohsomeApi/config/MvcConfig.java b/src/main/java/org/heigit/bigspatialdata/ohsome/ohsomeApi/config/MvcConfig.java index a2482f24..af187cf1 100644 --- a/src/main/java/org/heigit/bigspatialdata/ohsome/ohsomeApi/config/MvcConfig.java +++ b/src/main/java/org/heigit/bigspatialdata/ohsome/ohsomeApi/config/MvcConfig.java @@ -47,10 +47,13 @@ public Map getErrorAttributes(RequestAttributes requestAttribute errorAttributes.remove("exception"); errorAttributes.put("timestamp", LocalDateTime.now().format(DateTimeFormatter.ISO_DATE_TIME)); - if (errorAttributes.get("message").toString().equals("No message available")) + if (errorAttributes.get("message").toString().equals("No message available")) { errorAttributes.remove("requestUrl"); - else - errorAttributes.put("requestUrl", RequestInterceptor.requestUrl); + } else { + // ensures to include the requestUrl in the error-response only if a GET request was sent + if (!RequestInterceptor.requestUrl.split("\\?")[1].equals("null")) + errorAttributes.put("requestUrl", RequestInterceptor.requestUrl); + } return errorAttributes; } };