Created
August 29, 2009 19:47
-
-
Save radhikalism/177649 to your computer and use it in GitHub Desktop.
This file contains 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
diff --git a/src/compojure/http/request.clj b/src/compojure/http/request.clj | |
index 834736a..b0fd07d 100644 | |
--- a/src/compojure/http/request.clj | |
+++ b/src/compojure/http/request.clj | |
@@ -20,15 +20,18 @@ | |
(defn- parse-params | |
"Parse parameters from a string into a map." | |
[param-string separator] | |
- (reduce | |
- (fn [param-map s] | |
- (let [[key val] (re-split #"=" s)] | |
- (assoc-vec param-map | |
- (keyword (urldecode key)) | |
- (urldecode (or val ""))))) | |
- {} | |
- (remove blank? | |
- (re-split separator param-string)))) | |
+ (let [[param-map key-vec] | |
+ (reduce | |
+ (fn [[param-map key-vec] s] | |
+ (let [[key val] (re-split #"=" s)] | |
+ [(assoc-vec param-map | |
+ (keyword (urldecode key)) | |
+ (urldecode (or val ""))) | |
+ (conj key-vec (keyword (urldecode key)))])) | |
+ [{} []] | |
+ (remove blank? | |
+ (re-split separator param-string)))] | |
+ (with-meta param-map {:ordered-keys key-vec}))) | |
(defn parse-query-params | |
"Parse parameters from the query string." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment