             [ring.util.response :as r]
             [org.zalando.stups.friboo.ring :as ring]
             [clojure.data.json :as json])
-  (:import (clojure.lang ExceptionInfo)))
+  (:import (clojure.lang ExceptionInfo)
+           (org.apache.http.protocol HTTP)))
 
 (defn flatten-parameters
   "According to the swagger spec, parameter names are only unique with their type. This one assumes that parameter names

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

(def default-error
  (json/write-str

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

(defn health-endpoint
  "Adds a /.well-known/health endpoint for load balancer tests."
  [handler]
  (fn [request]
    (if (= (:uri request) "/.well-known/health")
      (-> (r/response "{\"health\": true}")
          (ring/content-type-json)
          (r/status 200))
      (handler request))))

(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
