Fork me on GitHub
#pedestal
<
2019-05-14
>
ikitommi05:05:50

I would say Pedestal is a framework, as it calls your code 😉 There is also reitit-pedestal add-on, which allows one to describe header-params with spec. With request-coercion interceptor mounted, validation, coercion (string->edn) and api-docs are pulled from those definitions. Would be something like:

["/headers"
 {:get {:summary "playing with header-params"
        :parameters {:header {:x-int pos-int?}}
        :interceptors [(coercion/coerce-request-interceptor)]
        :handler (fn [req]
                   {:status 200
                    :body {:value (-> req :parameters :header :x-int inc)}})}}]

jackson18:05:13

question about web sockets.. Is there a simple way to know which client closed their end so that I can remove them from my collection of clients? I've done some workarounds requiring the client to have an id as a query param and I can look them up by request on close, but I was hoping there was something simpler that I've been overlooking.

jackson19:05:30

update, keying off the hash of the request seems to work well enough without requiring the client to provide an id.