test/stallion.rb in astro-em-http-request-0.1.15 vs test/stallion.rb in astro-em-http-request-0.2.2
- old
+ new
@@ -85,11 +85,15 @@
elsif stable.request.head?
stable.response.status = 200
elsif stable.request.post?
- stable.response.write stable.request.body.read
+ if stable.request.path_info == '/echo_content_type'
+ stable.response.write stable.request.env["CONTENT_TYPE"]
+ else
+ stable.response.write stable.request.body.read
+ end
elsif stable.request.path_info == '/set_cookie'
stable.response["Set-Cookie"] = "id=1; expires=Tue, 09-Aug-2011 17:53:39 GMT; path=/;"
stable.response.write "cookie set"
@@ -124,10 +128,14 @@
stable.response.write 'success'
else
stable.response.status = 401
end
+ elsif stable.request.path_info == '/relative-location'
+ stable.response.status = 301
+ stable.response["Location"] = '/forwarded'
+
elsif
stable.response.write 'Hello, World!'
end
end
@@ -139,6 +147,6 @@
rescue Exception => e
print e
end
end
-sleep(1)
\ No newline at end of file
+sleep(1)