Skip to content

Instantly share code, notes, and snippets.

@bmizerany
Created May 26, 2009 18:48
Show Gist options
  • Save bmizerany/118217 to your computer and use it in GitHub Desktop.
Save bmizerany/118217 to your computer and use it in GitHub Desktop.
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