Skip to content

Commit f83b1f7

Browse files
committed
gracefully handle repl client page server requests in server only mode
1 parent c1cf559 commit f83b1f7

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed

src/main/clojure/cljs/repl/browser.clj

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -116,17 +116,20 @@
116116
(slurp (:client-js @browser-state)))
117117

118118
(defn send-repl-client-page
119-
[request conn opts]
120-
(server/send-and-close conn 200
121-
(str "<html><head><meta charset=\"UTF-8\"></head><body>
122-
<script type=\"text/javascript\">"
123-
(repl-client-js)
124-
"</script>"
125-
"<script type=\"text/javascript\">
126-
clojure.browser.repl.client.start(\"http://" (-> request :headers :host) "\");
119+
[{:keys [path] :as request} conn opts]
120+
(if-not browser-state
121+
(server/send-404 conn path)
122+
(server/send-and-close conn 200
123+
(str
124+
"<html><head><meta charset=\"UTF-8\"></head><body>"
125+
"<script type=\"text/javascript\">"
126+
(repl-client-js)
127+
"</script>"
128+
"<script type=\"text/javascript\">
129+
clojure.browser.repl.client.start(\"http://" (-> request :headers :host) "\");
127130
</script>"
128-
"</body></html>")
129-
"text/html"))
131+
"</body></html>")
132+
"text/html")))
130133

131134
(defn default-index [output-to]
132135
(str

0 commit comments

Comments
 (0)