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' |
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
aryeh [2016-06-08 13:51:26]:~/Development/faraday-test$ curl http://localhost:4567/run-test | |
response200: 200 | |
response400: 400 | |
response500: 500 |