Fork me on GitHub
#yada
<
2018-05-23
>
martinklepsch06:05:24

Not only yada specific but how do you deal with urls that may or may not have a trailing slash? e.g https://cljdoc.xyz/d/spicerack/spicerack/0.1.4/ vs. https://cljdoc.xyz/d/spicerack/spicerack/0.1.4 Is it common to redirect to the URLs with the trailing slash? Are there any helpers for this kind of thing?

dominicm07:05:38

Never had to solve this, but I speculate that something could walk the bidi structure and add those routes. It depends, as ever. In other ecosystems I see both redirecting and ignoring as common.

wdullaer07:05:18

if I'm serving static content (which might contain relative urls) I'll generally redirect, if I'm serving an api endpoint I generally ignore the trailing slash

martinklepsch12:05:17

Thanks, will add a redirect to one of them.

martinklepsch12:05:52

btw, I asked about how to keep my route-tree plain data. This is what I ended up doing: https://github.com/martinklepsch/cljdoc/blob/master/src/cljdoc/routes.clj#L6-L23

martinklepsch13:05:52

How can I set the response from an interceptor? (and prevent actual resource verbs to be called)

malcolmsparks13:05:41

You can throw ex-info with :status set to status code and :response

martinklepsch14:05:52

Is that “the way” to do things?

malcolmsparks15:05:42

Not really, just a workaround. What would be a better design? Changing interceptor chain at runtime?

martinklepsch16:05:42

From pedestal interceptors I’d probably empty the interceptor queue but my understanding of Yada’s interceptor impl is less good