Skip to content

Instantly share code, notes, and snippets.

@dadair-ca
Last active August 29, 2015 14:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dadair-ca/fa06e6885b109c7a7035 to your computer and use it in GitHub Desktop.
Save dadair-ca/fa06e6885b109c7a7035 to your computer and use it in GitHub Desktop.
Ring-mock BufferedInputStream coersion
(testing "Access should be granted on valid credentials."
(is (= (app (mock/header (mock/request :get "/api/echo" {:m "hi"})
"authorization" "Basic Zm9vOmJhcg=="))
{:status 200 :body "hi"}))))
@dadair-ca
Copy link
Author

The response's body is always returned as a:

#object[java.io.BufferedInputStream 0x... "java.io..."]

How can I have it return simply as the string "hi"? The BufferedInputStream isn't very human-readable if I was to include it in the test...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment