This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-03-02
Channels
- # aleph (2)
- # announcements (3)
- # babashka (12)
- # beginners (55)
- # calva (11)
- # clj-http (12)
- # cljs-dev (41)
- # cljtogether (2)
- # clojure (51)
- # clojure-denmark (2)
- # clojure-europe (32)
- # clojure-nl (17)
- # clojure-norway (2)
- # clojure-switzerland (1)
- # clojure-uk (3)
- # clojurescript (34)
- # cursive (20)
- # data-science (3)
- # datahike (23)
- # datomic (3)
- # events (1)
- # fulcro (1)
- # honeysql (4)
- # inf-clojure (2)
- # interop (38)
- # java (3)
- # kaocha (8)
- # lsp (51)
- # luminus (2)
- # malli (2)
- # nextjournal (5)
- # off-topic (21)
- # pedestal (2)
- # polylith (12)
- # re-frame (4)
- # reagent (8)
- # reitit (4)
- # releases (1)
- # ring (4)
- # shadow-cljs (179)
- # spacemacs (2)
- # specter (1)
- # xtdb (13)
I'm seeing unexpected behaviour, but I'm not sure if it warrants opening an issue. If the content-type request header is specified as anything other than "Content-Type"
(e.g. "content-type"
), the value of :content-type
is an empty string in (:request context)
. Perhaps related to https://github.com/pedestal/pedestal/issues/681? I'll share a reproducible example in the thread.
(ns server.issue
(:require
[io.pedestal.http :as http]
[io.pedestal.test :as test]
[io.pedestal.http.route :as route]))
(def echo
{:name ::echo
:enter
(fn [context]
(let [request (:request context)
;; to enable read-string
request* (dissoc request
:servlet-response
:servlet
:servlet-request
:body
:url-for)]
(assoc context :response
{:status 200 :body request*})))})
(def routes
(route/expand-routes #{["/echo" :get [echo]]}))
(def service-map
{::http/routes routes
::http/type :jetty
::http/port 8080})
(defonce server (atom nil))
(defn start-dev []
(reset! server
(-> service-map
(assoc ::http/join? false)
http/create-server
http/start)))
(defn stop-dev []
(http/stop @server))
(defn restart []
(stop-dev)
(start-dev))
(comment
(stop-dev)
(start-dev)
(restart)
(-> (test/response-for (:io.pedestal.http/service-fn @server) :get "/echo"
:headers {"content-type" "text/html"})
:body
read-string
:content-type)
(-> (test/response-for (:io.pedestal.http/service-fn @server) :get "/echo"
:headers {"Content-Type" "text/html"})
:body
read-string
:content-type)
;
)