File tree Expand file tree Collapse file tree 1 file changed +16
-18
lines changed
src/main/clojure/cljs/repl Expand file tree Collapse file tree 1 file changed +16
-18
lines changed Original file line number Diff line number Diff line change 2424(def ^:dynamic ordering nil )
2525(def ^:dynamic es nil )
2626
27+ (def ext->mime-type
28+ {" .html" " text/html"
29+ " .css" " text/css"
30+
31+ " .jpg" " image/jpeg"
32+ " .png" " image/png"
33+ " .gif" " image/gif"
34+
35+ " .js" " text/javascript"
36+ " .cljs" " text/x-clojure"
37+ " .cljc" " text/x-clojure"
38+ " .map" " application/json" })
39+
2740(defn- set-return-value-fn
2841 " Save the return value function which will be called when the next
2942 return value is received."
8497 local-path)]
8598 (if local-path
8699 (server/send-and-close conn 200 (slurp local-path)
87- (condp #(.endsWith %2 %1 ) path
88- " .html" " text/html"
89- " .css" " text/css"
90- " .html" " text/html"
91- " .jpg" " image/jpeg"
92- " .js" " text/javascript"
93- " .cljs" " text/x-clojure"
94- " .cljc" " text/x-clojure"
95- " .map" " application/json"
96- " .png" " image/png"
100+ (if (some #(.endsWith path %) (keys ext->mime-type))
101+ (get ext->mime-type path)
97102 " text/plain" ))
98103 (server/send-404 conn path)))
99104 (server/send-404 conn path)))
105110
106111(server/dispatch-on :get
107112 (fn [{:keys [path]} _ _]
108- (or
109- (= path " /" )
110- (.endsWith path " .js" )
111- (.endsWith path " .cljc" )
112- (.endsWith path " .cljs" )
113- (.endsWith path " .map" )
114- (.endsWith path " .html" )
115- (.endsWith path " .css" )))
113+ (or (= path " /" ) (some #(.endsWith path %) (keys ext->mime-type))))
116114 send-static)
117115
118116(defmulti handle-post (fn [m _ _ ] (:type m)))
You can’t perform that action at this time.
0 commit comments