Back

chars (clj)

(source)

function

(chars s)
Split a string in a seq of chars.

Examples

funcool/catacumba
(ns catacumba.tests.test-core
  (:require [clojure.core.async :as a]
            [clojure.test :refer :all]
            [clojure.java.io :as io]
            [clojure.pprint :refer [pprint]]
            [beicon.core :as rx]
            [clj-http.client :as client]
            [promesa.core :as p]
            [cuerdas.core :as str]
            [manifold.stream :as ms]
            [manifold.deferred :as md]
            [catacumba.core :as ct]
            [catacumba.http :as http]
            [catacumba.testing :refer [with-server]]
            [catacumba.tests.helpers :as th]
            [catacumba.handlers.misc])
  (:import ratpack.exec.Execution
           ratpack.func.Action
           ratpack.func.Block
           ratpack.exec.ExecInterceptor
           ratpack.exec.ExecInterceptor$ExecType
           java.io.ByteArrayInputStream))

  (testing "Using InputStream as body"
    (let [data (ByteArrayInputStream. (.getBytes "Hello world!" "UTF-8"))
          handler (fn [context]
                    (http/ok data {:content-type "text/plain;charset=utf-8"}))]
      (with-server {:handler handler}
        (let [response (th/get "/")]
          (is (= (:body response) "Hello world!"))
          (is (= (:status response) 200))))))

  (testing "Using InputStream as body"
    (let [data (.getBytes "Hello world!" "UTF-8")
          handler (fn [context]
                    (http/ok data {:content-type "text/plain;charset=utf-8"}))]
      (with-server {:handler handler}
        (let [response (th/get "/")]
          (is (= (:body response) "Hello world!"))
          (is (= (:status response) 200))))))
  )