Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
more work on README, a little tidy up on Client class
- Loading branch information
1 parent
f87de8f
commit 5d0c1b1
Showing
11 changed files
with
151 additions
and
152 deletions.
There are no files selected for viewing
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
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
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
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
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
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,30 @@ | ||
require_relative 'app' | ||
class MyApp | ||
|
||
def self.call(env) | ||
|
||
request = Rack::Request.new env | ||
logger = request.logger | ||
path = request.path_info | ||
|
||
if path && path.include?("sleep") | ||
duration = path.to_s.split("/").last.to_i | ||
duration.times do |n| | ||
logger.info "sleep #{n}" | ||
sleep(1) | ||
end | ||
end | ||
|
||
response = Rack::Response.new | ||
response.write "Method: #{request.request_method}\n" | ||
response.write "Path: #{path}\n" | ||
response.write "Query: #{request.query_string}\n" unless request.query_string.empty? | ||
response.write "Slept for: #{duration}\n" unless duration.nil? | ||
response.write request.body.read | ||
response.status = 200 | ||
response.finish | ||
|
||
end | ||
|
||
end | ||
|
||
run MyApp |
Oops, something went wrong.