Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integer Multipart Param: "Body may not be null" #287

Closed
turtlegrammar opened this issue Nov 5, 2015 · 1 comment
Closed

Integer Multipart Param: "Body may not be null" #287

turtlegrammar opened this issue Nov 5, 2015 · 1 comment

Comments

@turtlegrammar
Copy link
Contributor

Multipart params cannot be numbers:

(clj-http.client/post "http://localhost" {:multipart [{:name "number" :content 1}]})
;; => IllegalArgumentException Body may not be null  org.apache.http.util.Args.notNull (Args.java:54)

In clj-http.mutipart.create-multipart-entity, the type of (:content {:name "number" :content 1}) does not match any predicates in the cond clause, so part is bound to nil, which leads to the opaque error "Body may not be null."

Is there a reason why there isn't an else clause where things that aren't strings/streams/files/byte-arrays are stringified and treated as strings? At least, a clearer error would be helpful.

@dakrone
Copy link
Owner

dakrone commented Nov 9, 2015

I see this issue, I think the create-multipart-entity method should throw an exception on a nil part. Would you like to open a PR for this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants