diff --git a/CHANGELOG.md b/CHANGELOG.md index 6317fd7c..3b70436b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ * the `r/routes` returns just the path + data tuples as documented, not the compiled route results. To get the compiled results, use `r/compiled-routes` instead. * new [faster](https://github.com/metosin/reitit/blob/master/perf-test/clj/reitit/impl_perf_test.clj) and more correct encoders and decoders for query & path params. * query-parameters are encoded with `reitit.impl/form-encode`, so spaces are `+` instead of `%20`. +* correctly read `:header` params from request `:headers`, not `:header-params` * welcome route name conflict resolution! If router has routes with same names, router can't be created. fix 'em. * sequential child routes are allowed, enabling this: diff --git a/modules/reitit-core/src/reitit/coercion.cljc b/modules/reitit-core/src/reitit/coercion.cljc index c5e9c07c..d168adb3 100644 --- a/modules/reitit-core/src/reitit/coercion.cljc +++ b/modules/reitit-core/src/reitit/coercion.cljc @@ -38,7 +38,7 @@ {:query (->ParameterCoercion :query-params :string true true) :body (->ParameterCoercion :body-params :body false false) :form (->ParameterCoercion :form-params :string true true) - :header (->ParameterCoercion :header-params :string true true) + :header (->ParameterCoercion :headers :string true true) :path (->ParameterCoercion :path-params :string true true)}) (defn ^:no-doc request-coercion-failed! [result coercion value in request] diff --git a/test/cljc/reitit/ring_coercion_test.cljc b/test/cljc/reitit/ring_coercion_test.cljc index d212a150..82fc5a04 100644 --- a/test/cljc/reitit/ring_coercion_test.cljc +++ b/test/cljc/reitit/ring_coercion_test.cljc @@ -28,7 +28,7 @@ :query-params {"a" "1"} :body-params {:b 2} :form-params {:c 3} - :header-params {:d 4}}) + :headers {"d" "4"}}) (def invalid-request {:uri "/api/plus/5" @@ -40,7 +40,7 @@ :query-params {"a" "1"} :body-params {:b 2} :form-params {:c 3} - :header-params {:d -40}}) + :headers {"d" "-40"}}) (deftest spec-coercion-test (let [create (fn [middleware]