har-net-http

Capture HAR files from net/http requests.


License
MIT
Install
gem install har-net-http -v 0.1.0

Documentation

Har::Net::Http

This library captures HTTP(S) traffic made by net/http as HAR.

You can see examples of captured files here.

Installation

Add this line to your application's Gemfile:

gem 'har-net-http'

And then execute:

$ bundle install

Or install it yourself as:

$ gem install har-net-http

Usage

To capture a HAR, load this library:

require 'har/net/http'

# Reset the har, so that future requests will create a new HAR
Har::Net::HTTP.har = nil

Then, make some HTTP requests. If you prefer, you can also make HTTP requests with higher level libraries such as faraday, http.rb, rest-client, httparty or any other library that is built on top of Ruby's net/http library.

When you're done, capture the HAR:

har = JSON.stringify(Har::Net::HTTP.har)

# Do what you want with it!

Development

After checking out the repo, run bin/setup to install dependencies. Then, run rake spec to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and the created tag, and push the .gem file to rubygems.org.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/cucumber/har-net-http.

License

The gem is available as open source under the terms of the MIT License.