File tree Expand file tree Collapse file tree 2 files changed +13
-9
lines changed
src/liberator/resource/ping Expand file tree Collapse file tree 2 files changed +13
-9
lines changed Original file line number Diff line number Diff line change 77
88 :dependencies [[io.logicblocks/halboy " 6.0.0" ]
99 [io.logicblocks/hype " 2.0.0" ]
10- [io.logicblocks/liberator.mixin " 0.1.0-RC5 " ]]
10+ [io.logicblocks/liberator.mixin " 0.1.0-RC14 " ]]
1111
1212 :plugins [[lein-cloverage " 1.2.4" ]
1313 [lein-shell " 0.5.0" ]
Original file line number Diff line number Diff line change 22 (:require
33 [halboy.resource :as hal]
44 [hype.core :as hype]
5- [liberator.mixin.core :as mixin]
5+ [liberator.mixin.core :as lm-core]
6+ [liberator.mixin.util :as lm-util]
67 [liberator.mixin.json.core :as json-mixin]
78 [liberator.mixin.hypermedia.core :as hypermedia-mixin]
89 [liberator.mixin.hal.core :as hal-mixin]))
910
1011(defn definitions
11- ([{ :keys [router]} ]
12+ ([_ ]
1213 {:body (fn [_] {:message " pong" })
1314
15+ :self-link
16+ (fn [{:keys [request router]}]
17+ (hype/absolute-url-for request router :ping ))
18+
1419 :handle-ok
15- (fn [{ :keys [request resource] :as context} ]
16- (let [body-fn ( :body resource )
17- body ( body-fn context)]
20+ (fn [context]
21+ (let [body ( lm-util/resource-attribute-as-value context :body )
22+ self-link ( lm-util/resource-attribute-as-value context :self-link )]
1823 (hal/add-properties
19- (hal/new-resource
20- (hype/absolute-url-for request router :ping ))
24+ (hal/new-resource self-link)
2125 body)))}))
2226
2327(defn handler
2428 ([dependencies]
2529 (handler dependencies {}))
2630 ([dependencies overrides]
27- (mixin /build-resource
31+ (lm-core /build-resource
2832 (json-mixin/with-json-mixin dependencies)
2933 (hypermedia-mixin/with-hypermedia-mixin dependencies)
3034 (hal-mixin/with-hal-mixin dependencies)
You can’t perform that action at this time.
0 commit comments