diff --git a/lib/httparrot.ex b/lib/httparrot.ex
index 7fad75e..4987f8c 100644
--- a/lib/httparrot.ex
+++ b/lib/httparrot.ex
@@ -21,8 +21,8 @@ defmodule HTTParrot do
     if JSEX.is_json? body do
       body = JSEX.prettify!(body)
       headers = ListDict.put(headers, "content-length", integer_to_list(String.length(body)))
+      {:ok, req} = :cowboy_req.reply(status, headers, body, req)
     end
-    {:ok, req} = :cowboy_req.reply(status, headers, body, req)
     req
   end
 end
diff --git a/test/httparrot_test.exs b/test/httparrot_test.exs
index f393498..8387af3 100644
--- a/test/httparrot_test.exs
+++ b/test/httparrot_test.exs
@@ -18,8 +18,6 @@ defmodule HTTParrotTest do
   end
 
   test "'prettify_json' does nothing if body is not a JSON" do
-    expect(:cowboy_req, :reply, [{[:status, :headers, "<xml></xml>", :req1], {:ok, :req2}}])
-    assert prettify_json(:status, :headers, "<xml></xml>", :req1) == :req2
-    assert validate :cowboy_req
+    assert prettify_json(:status, :headers, "<xml></xml>", :req1) == :req1
   end
 end