Fork me on GitHub
#yada
<
2020-05-28
>
Andy Dwelly11:05:11

Generating a status 301?

Andy Dwelly12:05:58

I'm modelling a resource that may or may not exist, when it does exist it is html, but occasionally it's moved. I can handle the existence question using the :exists? property, and I can at the same time find if the underlying data has moved and add that information as a namespaced key in the context that the get response function ends up with. Just generating html is perfectly simple, but I'm not clear on the idiomatic approach to generating either html or a 301 status with a new location. Has anyone ever done this?

dominicm14:05:24

If you return a url that will generate a 301

dominicm14:05:38

You can also merge into the response key in the ctx

Andy Dwelly15:05:49

Thanks, I'll give that a try.