r0man / oauth-clj

Clojure OAuth library

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Allow use of non form-encoded payload

rukor opened this issue · comments

commented

At the moment, it always tries to make the request entity part of the base string irrespective of the content-type; this obviously run into issues when it tries to parse the body. So I changed parse-body-params to:

(defn parse-body-params
  "Parse the body of `request` as an URL encoded parameter list."
  [request]
  (let [body (to-str (:body request))]
    (if (and (= x-www-form-urlencoded (:content-type request))
             (not (blank? body)))
      (-> (apply hash-map (split body #"[=&]"))
          (transform-values url-decode))
      {})))

I can send a pull request if you prefer.

Thanks,
R

commented

@rukor Sorry, was AFK for some days. Yes, I would prefer a PR with a test. :)