Do not merge path params into params

makes conflict with possible params coming from user
This commit is contained in:
Andrey Antukh 2023-01-13 09:48:34 +01:00
parent fcbbe8e5c7
commit 095dc2ad11
2 changed files with 7 additions and 9 deletions

View file

@ -91,9 +91,7 @@
(let [params (:path-params match) (let [params (:path-params match)
result (:result match) result (:result match)
handler (or (:handler result) not-found-handler) handler (or (:handler result) not-found-handler)
request (-> request request (assoc request :path-params params)]
(assoc :path-params params)
(update :params merge params))]
(handler request respond raise)) (handler request respond raise))
(not-found-handler request respond raise))) (not-found-handler request respond raise)))

View file

@ -71,8 +71,8 @@
(defn- rpc-query-handler (defn- rpc-query-handler
"Ring handler that dispatches query requests and convert between "Ring handler that dispatches query requests and convert between
internal async flow into ring async flow." internal async flow into ring async flow."
[methods {:keys [profile-id session-id params] :as request} respond raise] [methods {:keys [profile-id session-id path-params params] :as request} respond raise]
(let [type (keyword (:type params)) (let [type (keyword (:type path-params))
data (-> params data (-> params
(assoc ::request-at (dt/now)) (assoc ::request-at (dt/now))
(assoc ::http/request request)) (assoc ::http/request request))
@ -94,8 +94,8 @@
(defn- rpc-mutation-handler (defn- rpc-mutation-handler
"Ring handler that dispatches mutation requests and convert between "Ring handler that dispatches mutation requests and convert between
internal async flow into ring async flow." internal async flow into ring async flow."
[methods {:keys [profile-id session-id params] :as request} respond raise] [methods {:keys [profile-id session-id path-params params] :as request} respond raise]
(let [type (keyword (:type params)) (let [type (keyword (:type path-params))
data (-> params data (-> params
(assoc ::request-at (dt/now)) (assoc ::request-at (dt/now))
(assoc ::http/request request)) (assoc ::http/request request))
@ -116,8 +116,8 @@
(defn- rpc-command-handler (defn- rpc-command-handler
"Ring handler that dispatches cmd requests and convert between "Ring handler that dispatches cmd requests and convert between
internal async flow into ring async flow." internal async flow into ring async flow."
[methods {:keys [profile-id session-id params] :as request} respond raise] [methods {:keys [profile-id session-id path-params params] :as request} respond raise]
(let [cmd (keyword (:type params)) (let [cmd (keyword (:type path-params))
etag (yrq/get-header request "if-none-match") etag (yrq/get-header request "if-none-match")
data (-> params data (-> params