Fork me on GitHub
#yada
<
2016-06-21
>
Michael Reilly09:06:58

Getting an unexpected error, trying to follow Mutation section of the instructions here https://juxt.pro/yada/manual/hello.html My code looks like this (require '[aleph.http :refer [start-server]] '[bidi.ring :refer [make-handler] :as bidi] '[yada.yada :refer [yada] :as yada]) (def hello-atom (yada (atom "Hello World!"))) (def api ["/hello-atom" hello-atom]) (def server (start-server (bidi/make-handler api) {:port 3000})) GET requests work as expected, but PUT gives 400 error $ curl -i http://localhost:3000/hello-atom -X PUT -d "Hello Dolly!" HTTP/1.1 400 Bad Request Content-Length: 260 Content-Type: application/json Server: Aleph/0.4.1 Connection: Keep-Alive Date: Tue, 21 Jun 2016 09:25:29 GMT {"status":400,"message":"Bad Request","id":"5a67ab22-c83a-40ac-aa52-a3e55610ca74","error":{"error":"clojure.lang.ExceptionInfo: Bad form fields {:status 400, :error (not (map? \"Hello Dolly!\"))}","data":"{:status 400, :error (not (map? \"Hello Dolly!\"))}"}}

malcolmsparks13:06:33

@mikeyr: try curl -i http://localhost:3000/hello-atom -X PUT -F 'value=Hello Dolly!'

malcolmsparks13:06:35

thanks for the report. I'm migrating this chapter over to http://juxt.pro currently and going through the examples, I'm not quite there yet

Michael Reilly14:06:25

@malcolmsparks: that worked. 10,000 thank yous!