cljs.repl.server/send-and-close

functionpreviously cljs.repl.browser/send-and-closeEdit
(send-and-close conn status form)
(send-and-close conn status form content-type)
(send-and-close conn status form content-type encoding)
(send-and-close conn status form content-type encoding gzip?)

Source docstring:
Use the passed connection to send a form to the browser. Send a
proper HTTP response.
Source code @ clojurescript:src/main/clojure/cljs/repl/server.clj
(defn send-and-close
  ([conn status form]
    (send-and-close conn status form "text/html"))
  ([conn status form content-type]
    (send-and-close conn status form content-type "UTF-8"))
  ([conn status form content-type encoding]
    (send-and-close conn status form content-type encoding false))
  ([conn status form content-type encoding gzip?]
    (let [byte-form (cond-> (.getBytes form encoding) gzip? gzip)
          content-length (count byte-form)
          headers (map #(.getBytes (str % "\r\n"))
                    (cond->
                      [(status-line status)
                       "Server: ClojureScript REPL"
                       (if (not= content-type "application/wasm")
                         (str "Content-Type: "
                              content-type
                              "; charset=" encoding)
                         (str "Content-Type: "
                              content-type))
                       (str "Content-Length: " content-length)]
                      gzip? (conj "Content-Encoding: gzip")
                      true (conj "")))]
      (with-open [os (.getOutputStream conn)]
        (doseq [header headers]
          (.write os header 0 (count header)))
        (.write os byte-form 0 content-length)
        (.flush os)
        (.close conn)))))