             handler (-> (s1st/swagger-context ::s1st/yaml-cp definition)
                         (s1st/swagger-ring add-ip-log-context)
                         (s1st/swagger-ring exceptions-to-json)
+                        (s1st/swagger-ring health-endpoint)
                         (s1st/swagger-ring wrap-params)
+                        (s1st/swagger-ring add-cors-allow-headers)
                         (s1st/swagger-mapper :cors-origin (:cors-origin configuration))
                         (s1st/swagger-discovery)
                         (s1st/swagger-parser)

        (log/error e "Undefined exception during request execution: %s" (str e))
        (format-undefined-error e)))))

(defn start-component
  "Starts the http component."
  [component definition mapper-fn]
  (if (:handler component)
    (do
      (log/debug "Skipping start of HTTP; already running.")
      component)

    (do

      ; TODO add user information, noop currently
      {}
      (handler request))))

(defn- add-cors-allow-headers
  "Adds Access-Control-Allow-Headers header for common headers you might need."
  [handler]
  (fn [request]
    (let [response (handler request)]
      (r/header response "Access-Control-Allow-Headers" "Origin, X-Requested-With, Content-Type, Accept, Authorization"))))

(def default-error
  (json/write-str
