cljs.repl.browser/send-and-close

MOVED, please see cljs.repl.server/send-and-close
functionremoved v0.0-1503added v0.0-927Edit
(send-and-close conn status form)
(send-and-close conn status form content-type)

Source docstring:
Use the passed connection to send a form to the browser. Send a
proper HTTP response.
Source code @ clojurescript:src/clj/cljs/repl/browser.clj
(defn send-and-close
  ([conn status form]
     (send-and-close conn status form "text/html"))
  ([conn status form content-type]
     (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"
                         (str "Content-Type: "
                              content-type
                              "; 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))))))