0.0
Repository is archived
No release in over a year
Capture HAR files from net/http requests.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
 Dependencies
 Project Readme

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.