Skip to content
Browse files

Fix inconsistency in form params.

In order to allow using one querystring for both the Go and Clojure versions of this code, we're using
underscores in the form params.
  • Loading branch information...
1 parent bc040d8 commit 295f43cfb4660f0d96367dbeb06eb6fc9385eb18 @mattdeboard committed
Showing with 6 additions and 6 deletions.
  1. +1 −1 benchmark/sample_post_data.txt
  2. +5 −5 clj/eventcapture/src/eventcapture/handler.clj
View
2 benchmark/sample_post_data.txt
@@ -1 +1 @@
-event-type=test&ext-ref=abc&user-ref=dude3&data={"a": 1}
+event_type=test&ext_ref=abc&user_ref=dude3&data={"a": 1}
View
10 clj/eventcapture/src/eventcapture/handler.clj
@@ -60,12 +60,12 @@
(defn handle-event-post [event-type ext-ref user-ref data]
(rule (string? event-type)
- [:event-type "Event type must be a non-empty string"])
+ [:event_type "Event type must be a non-empty string"])
(rule (not (strings/blank? event-type))
- [:event-type "Event type must be non-empty string"])
+ [:event_type "Event type must be non-empty string"])
(rule (string? data) [:data "Data must be a string."])
(rule (json/read-str data) [:data "Data must be a string."])
- (if (errors? :event-type :data)
+ (if (errors? :event_type :data)
(server-error (get-errors))
(insert-event {:event_type event-type
:ext_ref ext-ref
@@ -74,8 +74,8 @@
(defroutes app-routes
(GET "/" [] "It works!")
- (POST "/capture" [event-type ext-ref user-ref data]
- (handle-event-post event-type ext-ref user-ref data))
+ (POST "/capture" [event_type ext_ref user_ref data]
+ (handle-event-post event_type ext_ref user_ref data))
(route/resources "/")
(route/not-found "Not Found"))

0 comments on commit 295f43c

Please sign in to comment.
Something went wrong with that request. Please try again.