Fork me on GitHub
#yada
<
2016-02-08
>
imre10:02:28

@malcolmsparks: I just noticed that the PUT method seems to be overwriting my http status codes, is this by design?

imre10:02:45

(request [_ ctx]
    (let [f (get-in ctx [:resource :methods (:method ctx) :response]
                    (fn [_] (d/error-deferred
                             (ex-info (format "Resource %s does not provide a handler for :put" (type (:resource ctx)))
                                     {:status 500}))))]
      (d/chain
       (f ctx)
       (fn [res]
         (assoc-in ctx [:response :status]
                   (cond
                     ;; TODO: A 202 may be not what the user wants!
                     ;; TODO: See RFC7240
                     (d/deferred? res) 202
                     (ctx/exists? ctx) 204
                     :otherwise 201))))))

malcolmsparks10:02:02

Ah, you're right - I haven't got something similar to POST (interpret-post-result) therefore you can't return responses. Let me fix that. You're returning a modified (:response ctx) in your handler?

imre10:02:29

yes, for example when my domain finds that a request in unauthorized I explicitly set 401 in the response

malcolmsparks10:02:07

OK, are you able to take an updated yada release?

malcolmsparks10:02:20

ok, give me a few mins

malcolmsparks10:02:37

[yada "1.1.0-20160207.113859-19"]

imre10:02:30

trying now

malcolmsparks10:02:42

Travis CI passing

malcolmsparks10:02:39

In other news, I'm now in documentation mode much more now and have broken the user-manual into chapters. I'm publishing the user-manual as a e-book https://leanpub.com/yada but the markdown sources will always be available in the yada repo

malcolmsparks10:02:00

The old single-file format was become unwieldy

imre10:02:59

[yada "1.1.0-20160208.103019-20"] seems to be the right version number

imre10:02:23

trying that now

imre10:02:27

that worked, thanks for the quick action!

malcolmsparks10:02:30

yeah, sorry, I pasted the -20 line into the README, killed the -19 line, and that was in my yank buffer when I pasted to slack - schoolboy error!

malcolmsparks10:02:43

I need to go on a copy-and-paste training course

malcolmsparks10:02:12

oh sorry @dominicm is that another slack faux-pas from me? I must learn to react properly simple_smile