test/all.rb in syro-2.1.1 vs test/all.rb in syro-2.1.2
- old
+ new
@@ -191,10 +191,15 @@
end
on "json" do
run(json)
end
+
+ on "private" do
+ res.status = 401
+ res.write("Unauthorized")
+ end
end
setup do
Driver.new(app)
end
@@ -317,6 +322,14 @@
params = JSON.generate(foo: "foo")
f.post("/json", params)
assert_equal params, f.last_response.body
+end
+
+test "set content type if body is set" do |f|
+ f.get("/private")
+
+ assert_equal 401, f.last_response.status
+ assert_equal "Unauthorized", f.last_response.body
+ assert_equal "text/html", f.last_response.headers["Content-Type"]
end