   when the return value is received."
   [form return-value-fn]
   (do (set-return-value-fn return-value-fn)
-      (send-and-close @(connection) 200 form)))
+      (send-and-close @(connection) 200 form "text/javascript")))
 
 (defn return-value
   "Called by the server when a return value is received."

    404 "HTTP/1.1 404 Not Found"
    "HTTP/1.1 500 Error"))

(defn send-and-close
  "Use the passed connection to send a form to the browser. Send a
  proper HTTP response."
  [conn status form]
  (let [utf-8-form (.getBytes form "UTF-8")
        content-length (count utf-8-form)
        headers (map #(.getBytes (str % "\r\n"))
                     [(status-line status)
                      "Server: ClojureScript REPL"
                      "Content-Type: text/html; charset=utf_8"
                      (str "Content-Length: " content-length)
                      ""])]
    (with-open [os (.getOutputStream conn)]
      (do (doseq [header headers]
            (.write os header 0 (count header)))
          (.write os utf-8-form 0 content-length)
          (.flush os)
          (.close conn)))))

(defn send-404 [conn path]
  (send-and-close conn 404
                  (str "<html><body>"
                       "<h2>Page not found</h2>"
                       "No page " path " found on this server."
                       "</body></html>")))

(defn send-for-eval
  "Given a form and a return value function, send the form to the

      (send-repl-client-page opts conn request)
      (let [file (io/file (str (:root opts) path))]
        (if (.exists file)
          (send-and-close conn 200 (slurp file) (content-type (.getName file)))
          (send-404 conn (:path request)))))))

(defn- handle-connection
