Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
use Rack::ContentType, "text/plain"
use Rack::ContentLength
run lambda {|env| [200, {}, [env['REMOTE_ADDR'].split(",").first]]}
require 'sinatra/base'
run Sinatra.new {
get('/') do
content_type "text/plain" # you can also use Rack::ContentType
# with Sinatra except here we want
# more control since Sinatra gives it
# to us. Rack::ContentType sets the
# Content-Type on every route/url for
# the current mapping.
request.env['REMOTE_ADDR'].split(",").first
end
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment