diff --git a/src/nl/surf/eduhub_rio_mapper/endpoints/api.clj b/src/nl/surf/eduhub_rio_mapper/endpoints/api.clj index 1ee4ec5f..51b7b3cc 100644 --- a/src/nl/surf/eduhub_rio_mapper/endpoints/api.clj +++ b/src/nl/surf/eduhub_rio_mapper/endpoints/api.clj @@ -236,7 +236,8 @@ (wrap-json-response) (wrap-trace-context) (defaults/wrap-defaults defaults/api-defaults) - (wrap-server-status)))) + (wrap-server-status) + (app-server/wrap-not-found-handler "serve-api says 404\n")))) (defn shutdown-handler [] ;; All subsequent requests will get a 503 error diff --git a/src/nl/surf/eduhub_rio_mapper/endpoints/app_server.clj b/src/nl/surf/eduhub_rio_mapper/endpoints/app_server.clj index fb31100f..40ad1463 100644 --- a/src/nl/surf/eduhub_rio_mapper/endpoints/app_server.clj +++ b/src/nl/surf/eduhub_rio_mapper/endpoints/app_server.clj @@ -17,9 +17,17 @@ ;; . (ns nl.surf.eduhub-rio-mapper.endpoints.app-server - (:require [ring.adapter.jetty :as jetty]) + (:require [nl.jomco.http-status-codes :as http-status] + [ring.adapter.jetty :as jetty]) (:import [org.eclipse.jetty.server HttpConnectionFactory])) +(defn wrap-not-found-handler [app msg] + (fn [req] + (let [response (app req)] + (if (= http-status/not-found (:status response)) + (assoc response :body (str msg (:body response))) + response)))) + (defn run-jetty [app host port] (jetty/run-jetty app {:host host diff --git a/src/nl/surf/eduhub_rio_mapper/endpoints/worker_api.clj b/src/nl/surf/eduhub_rio_mapper/endpoints/worker_api.clj index d17b502c..1bdee3be 100644 --- a/src/nl/surf/eduhub_rio_mapper/endpoints/worker_api.clj +++ b/src/nl/surf/eduhub_rio_mapper/endpoints/worker_api.clj @@ -42,7 +42,8 @@ (wrap-json-response) (wrap-logging) (wrap-trace-context) - (defaults/wrap-defaults defaults/api-defaults))) + (defaults/wrap-defaults defaults/api-defaults) + (app-server/wrap-not-found-handler "worker-api says 404\n"))) (defn serve-api [{{:keys [^Integer port host]} :worker-api-config :as config}]