简体   繁体   中英

Clojure Ring auto-refresh script for error screen

When :auto-reload? true :auto-reload? true , Ring injects an auto refresh <script> tag via its internal wrap-reload middleware whenever you return a status full HTML page. However, this auto-refresh script is not included when an error occurs. As a result, I have to manually refresh the page.

How can I tell Ring to inject an auto-refresh script into its error screen as well?

This is in my project.clj :

:ring {:handler my-app.handler/app
       :auto-reload? true
       :auto-refresh? true}

Since the auto-refresh is added to the successful response, perhaps it needs to also be added to the error response. You could add a custom error response that returns a 500 error whose body includes the auto refresh script.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM