File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 382382 form `(~body-wrap ~@body)
383383 form (if (seq letks) `(letk ~letks ~form) form)
384384 form (if (seq lets) `(let ~lets ~form) form)
385- form (if (seq middleware)
386- `(let [wrap-mw# (mw/compose-middleware ~middleware)]
387- ((wrap-mw# (fn [~arg] ~form)) ~arg))
388- form)
389- form (if (seq pre-lets) `(let ~pre-lets ~form) form)
390385 form (if routes
391386 `(compojure.core/context ~path ~arg-with-request ~form)
392387 (compojure.core/compile-route method path arg-with-request (list form)))
388+ form (if (seq middleware)
389+ `(compojure.core/wrap-routes ~form (mw/compose-middleware ~middleware))
390+ form)
391+ form (if (seq pre-lets) `(let ~pre-lets ~form) form)
393392
394393 ; ; for routes, create a separate lookup-function to find the inner routes
395394 child-form (if routes
Original file line number Diff line number Diff line change 138138 (app {:request-method :get :uri " /api/ping" :query-params {:x " abba" }}) => (contains {:body [" abba" 0 ]})
139139 (app {:request-method :get :uri " /api/ping" :query-params {:x " 1" }}) => (contains {:body [" 1" 0 ]})
140140 (app {:request-method :get :uri " /api/ping" :query-params {:x " 1" , :y 2 }}) => (contains {:body [" 1" 2 ]})
141- (app {:request-method :get :uri " /api/ping" :query-params {:x " 1" , :y " abba" }}) => throws )))
141+ (app {:request-method :get :uri " /api/ping" :query-params {:x " 1" , :y " abba" }}) => throws ))
142+
143+ (fact " context coercion is used for subroutes"
144+ (let [app (context " /api" []
145+ :coercion (constantly nil )
146+ (GET " /ping" []
147+ :query-params [x :- Long]
148+ (ok x)))]
149+ (app {:request-method :get :uri " /api/ping" :query-params {:x " abba" }}) => (contains {:body " abba" }))) )
You can’t perform that action at this time.
0 commit comments