Created
May 1, 2017 06:43
-
-
Save sw-samuraj/af6ee199af9b0b12477595f8a54f94a5 to your computer and use it in GitHub Desktop.
An example of Ring middlewares wrap-params and wrap-keyword-params (for a blog post).
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 blog-ring.middleware | |
(:require [ring.middleware.params :refer [wrap-params]] | |
[ring.middleware.keyword-params :refer [wrap-keyword-params]])) | |
((wrap-params identity) | |
{:query-string "clojure=yes&lisp=maybe"}) | |
;; -> {:query-string "clojure=yes&lisp=maybe", | |
;; :form-params {}, | |
;; :params {"clojure" "yes", "lisp" "maybe"}, | |
;; :query-params {"clojure" "yes", "lisp" "maybe"}} | |
((wrap-keyword-params identity) | |
{:params {"clojure" "yes" "lisp" "maybe"}}) | |
;; -> {:params {:clojure "yes", :lisp "maybe"}} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment