Execute http request from apache access log
Installation
$ gem install playback
Usage
as a command line tool
$ playback 'http://httpbin.org' /path/to/access.log
#=> { "method": "GET", "path": "/get", "status": 200 }
#=> { "method": "POST", "path": "/post?hoge=1", "status": 404 }
#=> { "method": "PUT", "path": "/put?foo=bar", "status": 200 }
#=> :
#=> :
as a part of code
require 'playback'
p = Playback::Request.new('http://httpbin.org')
File.open '/path/to/access.log' do |file|
file.each_line do |line|
puts p.run(line) #=> { "method": "GET", "path": "/get", "status": 200 }
puts p.run(line, 'net-http') #=> #<Net::HTTPOK:0xb8309eb4>
end
end
Contributing
- Fork it ( https://github.com/takady/playback/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request