File tree Expand file tree Collapse file tree 4 files changed +18
-26
lines changed
src/main/com/yetanalytics/lrs/pedestal Expand file tree Collapse file tree 4 files changed +18
-26
lines changed Original file line number Diff line number Diff line change 7474 {:name ::set-version-bindings
7575 :enter (fn [ctx]
7676 (if-let [version (:com.yetanalytics.lrs/version ctx)]
77- (update
78- ctx
79- :bindings
80- assoc
81- #'xapi-schema.spec/*xapi-version*
82- (cond
83- (cstr/starts-with? version " 1" ) " 1.0.3"
84- (cstr/starts-with? version " 2" ) " 2.0.0" ))
77+ (let [spec-version (cond
78+ (cstr/starts-with? version " 1" ) " 1.0.3"
79+ (cstr/starts-with? version " 2" ) " 2.0.0" )]
80+ (-> ctx
81+ (assoc :com.yetanalytics.lrs/spec-version spec-version)
82+ (update
83+ :bindings
84+ assoc
85+ #'xapi-schema.spec/*xapi-version*
86+ spec-version)))
8587 ctx))
8688 :leave (fn [ctx]
8789 (update ctx :bindings dissoc #'xapi-schema.spec/*xapi-version*))}))
176178 (assoc-in ctx
177179 [:response :headers " x-experience-api-version" ]
178180 ; ; Get version from context or latest patch
179- (:com.yetanalytics.lrs/version ctx " 2.0.0" )))}))
181+ (:com.yetanalytics.lrs/spec- version ctx " 2.0.0" )))}))
180182
181183(defn calculate-etag [x]
182184 (sha-1 x))
Original file line number Diff line number Diff line change 5252 (let [version (:com.yetanalytics.lrs/version ctx)]
5353 ; ; Version 2.0.0 and up do not allow this so we error
5454 (if (or (nil? version)
55- (not (.startsWith ^String version " 1.0 " )))
55+ (not (.startsWith ^String version " 1" )))
5656 (error!
5757 ctx
5858 " xAPI alternate request syntax not supported!" )
190190 #?(:clj (conform-cheshire spec-kw raw-params)
191191 ; ; Force binding of spec version in cljs
192192 :cljs
193- (let [v (:com.yetanalytics.lrs/version ctx)]
194- (binding [xs/*xapi-version*
195- (cond
196- (cstr/starts-with? v " 1" )
197- " 1.0.3"
198- (cstr/starts-with? v " 2" )
199- " 2.0.0" )]
193+ (let [v (:com.yetanalytics.lrs/spec-version ctx)]
194+ (binding [xs/*xapi-version* (or v " 2.0.0" )]
200195 (conform-cheshire spec-kw raw-params))))
201196 {:keys [path-info
202197 request-method]} request]
Original file line number Diff line number Diff line change 240240 #?(:clj (validate-request-statements* ctx)
241241 ; ; Force binding of spec version in cljs
242242 :cljs
243- (let [version (:com.yetanalytics.lrs/version ctx)]
244- (binding [xs/*xapi-version* (cond
245- (cs/starts-with? version " 1" )
246- " 1.0.3"
247- (cs/starts-with? version " 2" )
248- " 2.0.0" )]
249- (validate-request-statements* ctx)))))})
243+ (binding [xs/*xapi-version* (:com.yetanalytics.lrs/spec-version ctx " 2.0.0" )]
244+ (validate-request-statements* ctx))))})
250245
251246(defn scan-attachments
252247 " Scan attachment files with a user-provided function."
Original file line number Diff line number Diff line change 303303 (if (and (or
304304 ; ; In 2.0, no headers ok for no doc
305305 (= " 2.0.0"
306- (:com.yetanalytics.lrs/version ctx))
306+ (:com.yetanalytics.lrs/spec- version ctx))
307307 ; ; prior tests seem to want this for everything but
308308 ; ; profiles
309309 (not (#{:xapi.activities.profile.PUT.request/params
338338 (if (and (or
339339 ; ; In 2.0, no headers ok for no doc
340340 (= " 2.0.0"
341- (:com.yetanalytics.lrs/version ctx))
341+ (:com.yetanalytics.lrs/spec- version ctx))
342342 ; ; prior tests seem to want this for everything but
343343 ; ; profiles
344344 (not (#{:xapi.activities.profile.PUT.request/params
You can’t perform that action at this time.
0 commit comments