Created
June 8, 2016 20:52
-
-
Save aryeh-looker/277a196269e9cfc8755f8315f29f39e2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'sinatra' | |
require 'faraday' | |
conn = Faraday.new(:url => 'http://localhost:4567') do |builder| | |
builder.adapter(Faraday.default_adapter) | |
end | |
get '/run-test' do | |
response200 = (conn.post '/200').status rescue 'raised error' | |
response400 = (conn.post '/400').status rescue 'raised error' | |
response500 = (conn.post '/500').status rescue 'raised error' | |
[ | |
"response200: #{response200.inspect}", | |
"response400: #{response400.inspect}", | |
"response500: #{response500.inspect}" | |
].join("\n") | |
end | |
post '/200' do | |
status 200 | |
end | |
post '/400' do | |
status 400 | |
end | |
post '/500' do | |
status 500 | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment