Reading about the https://cljdoc.org/d/metosin/reitit/0.5.13/api/reitit.ring.middleware.parameters, it says:
> Middleware to parse urlencoded parameters from the query string and form body (if the request is a url-encoded form). Adds the following keys to the request map:
> :query-params - a map of parameters from the query string
> :form-params - a map of parameters from the body
> :params - a merged map of all types of parameter
Is there any reason :body-params
is not included in the :params
map?
The project I am working on has a website and API, so requests will have either :form-params
(from the browser) or :body-params
(from an API client). At the moment I am doing this:
(let [body (val (first (select-keys (:parameters req) [:body :form])))
title (:title body)
message (:message body)]
...)
If :body-params
was included in :params
I could do this:
(let [params (:params req)
title (:title params)
message (:message params)]
...)
Hello, I'm trying to get the simple websocket handshake working from the aleph example at https://github.com/clj-commons/aleph/blob/master/examples/src/aleph/examples/websocket.clj I'm instead using reitit over compojure but I'm getting an error when I try to execute
@(http/websocket-client "<ws://localhost:10000/echo>")
Execution error (WebSocketHandshakeException) at io.netty.handler.codec.http.websocketx.WebSocketClientHandshaker13/verify (WebSocketClientHandshaker13.java:274).
Invalid handshake response getStatus: 500 Server Error
I tried comparing the requests receieve by my "echo" handler in reitit vs the one in compojure but they mostly look the same to me.Hi. I made a fork of ring-oauth2 which provides routes for reitit. https://github.com/green-coder/reitit-oauth2