Fork me on GitHub
#reitit
<
2021-12-15
>
Ian Fernandez03:12:05

I'm having problems using Sente

Ian Fernandez03:12:25

Client's Ring request doesn't have a client id. Does your server have the necessary keyword Ring middleware (`wrap-params` & `wrap-keyword-params`)?%
for this request:
curl --include \                             
     --no-buffer \
     --header "Connection: Upgrade" \
     --header "Upgrade: websocket" \
     --header "Host: " \
     --header "Origin: " \
     --header "Sec-WebSocket-Version: 13" \
     

Ian Fernandez03:12:06

this is my Routes on Router:

[ ["/healthcheck"
   {:name :healthcheck,
    :get
    {:summary "Returns 200 and some server info if server is OK",
     :handler
     (fn [_]
       {:status 200
        :body   {:status "OK"}})},
    :options
    {:no-doc true,
     :handler reitit.ring/default-options-handler}}]
 [""
  {:no-doc true, :braveno.common.oidc.ring/public true}
  ["/api/v2/swagger.json"
   {:get
    {:handler
     (swagger/create-swagger-handler)
     :swagger {:info {:title "Braveno v2 API"}}}}]
  ["/api/v2/docs/*"
   {:get
    {:handler (swagger-ui/create-swagger-ui-handler
                {:url    "/api/v2/swagger.json"
                 :config {:validatorUrl nil}})}}]]
 ["/chsk"
  {:name :chanel-endpoint,
   :get
   {:summary "GET websocket",
    :handler
    (fn [req]
      (ring-ajax-get-or-ws-handshake req))},
   :post
   {:summary "POST websocket",
    :handler
    (fn [req]
      (ring-ajax-post req))},
   :options
   {:no-doc true,
    :handler
    reitit.ring/default-options-handler}}]]

Ian Fernandez03:12:02

these are mine middlewares:

{:data     {:coercion   rs/coercion
            :middleware [middleware.cors/wrap-access-control
                         muuntaja/format-middleware
                         rrmp/parameters-middleware
                         rrc/coerce-exceptions-middleware
                         rrc/coerce-request-middleware
                         rrc/coerce-response-middleware]
            :muuntaja   m/instance
            :compile    rc/compile-request-coercers}
 :validate rrs/validate}

Ian Fernandez03:12:20

Which would be the problem?

Ian Fernandez03:12:02

rrmp/parameters-middleware would be enough for having (`wrap-params` & wrap-keyword-params) ???

Noah Bogart03:12:00

this is a sente question, not a reitit question, but i think i can help

Noah Bogart03:12:30

the url of your curl request doesn’t have the client-id as a query string: /chsk?client-id=f93ccd7d-0897-4afe-aaf0-a21c024917d2&csrf-token=Xr74j+V5bRRlrnZ25r4M6S9Px6942RjYRFdiUU/tnzQcW+s4SU1OFceIHfSTGXe6EZADx+fKN6MT6omU

👍 1
Noah Bogart03:12:02

there’s an example from my app, which includes the csrf token as a query string as well

Ian Fernandez04:12:18

Where is the example? :)

Noah Bogart05:12:52

oh, you thought i meant like code, no, i’m just referring to the previous message