Created
June 19, 2014 16:14
-
-
Save oliyh/5f0f84125c5352921726 to your computer and use it in GitHub Desktop.
Failing test describing how interaction with middleware like wrap-params results in unexpected entries in the route-params map
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns bidi.bidi-test | |
(:require [clojure.test :refer :all] | |
[bidi.bidi :refer :all] | |
[ring.mock.request :refer :all])) | |
(deftest route-params-hygiene-test | |
(testing "other request constraints" | |
(let [handler | |
(make-handler [["/blog/user/" :userid "/article"] | |
(fn [req] {:status 201 :body (:route-params req)})])] | |
(is handler) | |
(testing "specified params like userid make it into :route-params | |
but other params do not" | |
(is (= (handler (-> (request :put "/blog/user/8888/article") | |
(assoc :params {"foo" "bar"}))) | |
{:status 201 :body {:userid "8888"}})))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment