Skip to content

Commit

Permalink
Added getter for redirect_time value
Browse files Browse the repository at this point in the history
  • Loading branch information
jarthod committed Feb 20, 2015
1 parent 7cb4dba commit e83b82a
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 1 deletion.
7 changes: 7 additions & 0 deletions CHANGELOG.md
@@ -1,5 +1,12 @@
# Changelog

## Master

[Full Changelog](http://github.com/typhoeus/typhoeus/compare/v0.7.1...master)

* Added getter for `redirect_time` value.
([Adrien Jarthon](https://github.com/jarthod))

## 0.7.1

[Full Changelog](http://github.com/typhoeus/typhoeus/compare/v0.7.0...v0.7.1)
Expand Down
13 changes: 13 additions & 0 deletions lib/typhoeus/response/informations.rb
Expand Up @@ -160,6 +160,19 @@ def namelookup_time
end
alias :name_lookup_time :namelookup_time

# Return the time, in seconds, it took for all redirection steps
# include name lookup, connect, pretransfer and transfer before the
# final transaction was started. time_redirect shows the complete
# execution time for multiple redirections.
#
# @example Get redirect_time.
# response.redirect_time
#
# @return [ Float ] The redirect_time.
def redirect_time
options[:redirect_time]
end

# Return the last used effective url.
#
# @example Get effective_url.
Expand Down
8 changes: 8 additions & 0 deletions spec/typhoeus/response/informations_spec.rb
Expand Up @@ -152,6 +152,14 @@
end
end

describe "#redirect_time" do
let(:options) { { :redirect_time => 1 } }

it "returns redirect_time from options" do
expect(response.redirect_time).to eq(1)
end
end

describe "#effective_url" do
let(:options) { { :effective_url => "http://www.example.com" } }

Expand Down
2 changes: 1 addition & 1 deletion typhoeus.gemspec
Expand Up @@ -17,7 +17,7 @@ Gem::Specification.new do |s|
s.required_rubygems_version = ">= 1.3.6"
s.license = 'MIT'

s.add_dependency('ethon', [">= 0.7.1"])
s.add_dependency('ethon', [">= 0.7.2"])

s.files = `git ls-files`.split("\n")
s.test_files = `git ls-files -- spec/*`.split("\n")
Expand Down

0 comments on commit e83b82a

Please sign in to comment.