Skip to content

Instantly share code, notes, and snippets.

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