Closed tomoharu-fujita closed 6 years ago
Any news on this?
Since Object
is encoded, it seems reasonable to encode nil
as a blank string.
However, I'm not sure that a&b=1
should be decoded as {:a nil :b "1"}
. It should probably raise an error instead.
@buob: The exception is likely is likely caused by (:id user)
or (:auth-token user)
being nil
.
Fixed by #18
form-encode fails to encode if nil value is in map:
user=> (require '[ring.util.codec :as codec]) user=> (codec/form-encode (codec/form-decode "a&b=1")) IllegalArgumentException No implementation of method: :form-encode* of protocol: #'ring.util.codec/FormEncodeable found for class: nil clojure.core/-cache-protocol-fn (core_deftype.clj:541)
It would be nicer if nil value treated as is.
user=> (extend-type nil
_=> codec/FormEncodeable
=> (form-encode* [ _] ""))
nil user=> (codec/form-encode (codec/form-decode "a&b=1")) "b=1&a="