Last active
July 1, 2021 10:59
-
-
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
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
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