Skip to content

Instantly share code, notes, and snippets.

@gourshete
Last active July 1, 2021 10:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gourshete/0a7a99300868b49c62ac87c895b923bc to your computer and use it in GitHub Desktop.
Save gourshete/0a7a99300868b49c62ac87c895b923bc to your computer and use it in GitHub Desktop.
Simple demonstration of web server calling to a Rack app and handling response
env = {
'REQUEST_METHOD' => 'GET',
'PATH_INFO' => '/hello',
'HTTP_HOST' => 'railsexamples.com',
# ...
}
status, headers, body = app.call(env)
status # => 200
headers # => { 'Content-Type' => 'text/plain' }
body # => ['Hello World']
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment