325 Commits

Author SHA1 Message Date
Mislav Marohnić
b4095c67be Remove leftright support
I don't really use it and it seems broken with Minitest
2015-10-02 17:31:55 +02:00
Mislav Marohnić
faf501b277 Fix default port numbers for Net::HTTP adapters
When Addressable::URI is used, the `port` property will be nil unless
port was explicitly specified. This made Addressable unusable in HTTPS
scenarios with Net::HTTP adapters, which would default to port 80 even
when the scheme was "https".
2015-08-20 22:25:47 -07:00
Mislav Marohnić
a39183e3ef Relax test coverage treshold for no-SSL suite
The no-SSL test run won't exercise any of the SSL setup code and would
thus dip slightly below treshold:
https://travis-ci.org/lostisland/faraday/jobs/69787142
2015-07-06 14:29:57 -07:00
Mislav Marohnić
ecfa6ccd46 Simplify retry with original body test 2015-06-12 02:04:57 +02:00
Mark Campbell
a8529feda2 Add test coverage for POST with Retry middleware
There was a fix put in bc82276 (#296) that preserved the body of a
POST request that was being retried in the Retry middleware.
Unfortunately, there was no test added that ensures that this
functionality continues to work.

This commit adds the test to ensure that it continues to work in the
future.
2015-06-12 02:04:57 +02:00
Ben Hanzl
245873dad1 Skip Patron tests if Ruby version less than 1.9 2015-06-12 01:58:58 +02:00
Rahul Horé
15a045d348 Skip Typhoeus tests for Ruby 2.2+
Old Typhoeus version doesn't seem to compile on this version of Ruby anymore.
2015-02-03 21:36:09 -08:00
Alexander Pepper
c877521697 httpclient: Enable gzip compression.
Motivation: httpclient support gzip compression since late 2010 (see https://github.com/nahi/httpclient/issues/42 ).
2015-01-14 15:27:00 +01:00
risk danger olson
6262970390 Merge pull request #437 from deseretbook/add-retry-option-to-ignore-idempotent-methods
Allow specifying methods that bypass :retry_if on Request::Retry
2015-01-07 09:58:04 -07:00
Ruslan Korolev
416a91bd8c testing negative numbers for retries 2014-11-26 13:50:26 +03:00
Mike Bourgeous
b1948c994b Added tests of customizable methods to retry without calling retry_if. 2014-11-13 16:30:22 -07:00
Erik Michaels-Ober
ac7cc3a7bf Merge pull request #277 from stve/log_bodies
log request bodies in logger middleware
2014-10-05 19:22:32 +02:00
Mislav Marohnić
8601c97190 Increase test coverage for parameter encoders 2014-09-19 13:31:25 -06:00
Mislav Marohnić
731f49039d Fix passing ActiveSupport::SafeBuffer to param encoders
Simply re-use `Faraday::Utils.escape/unescape` instead of reimplementing
them for each encoder.
2014-09-19 12:46:24 -06:00
Erik Michaels-Ober
b88c4846fa Don't require SimpleCov on Ruby 1.8 2014-07-22 07:07:24 +02:00
Janko Marohnić
edacd5eb57 Fix response not changing with parallel requests
In this order the @env would not be changed by the "on complete"
callbacks, meaning that the response would not change after parallel
requests finish (e.g. JSON would not be parsed).

This would work

  def on_complete(env)
    env[:body].upcase!
  end

But this wouldn't

  def on_complete(env)
    env[:body] = env[:body].upcase
  end
2014-05-23 14:03:39 +02:00
Mauricio Linhares
ee6aba99be Retry only if the method is idempotent
Only run retries if the method is known to be
idempotent. If it isn't, switch to use the retry_if
block to make the final decision, if it is known to
be idempotent allow it to be retried by default.
2014-02-11 10:29:53 -03:00
Mauricio Linhares
65b5e8a440 Adds a retry_if option to the retry middleware
retry_if allows users to provide a block that
will receive the env and exception objects
and should decide if the call should be retried
or not.

Fixes #298.
2014-02-11 10:29:52 -03:00
Erik Michaels-Ober
c8b03d9241 Fix tests on Ruby 1.8 2014-01-16 02:34:27 +01:00
Erik Michaels-Ober
cf544f8650 Make Faraday::Options more Hash-like
Since Faraday::Options is replacing a Hash in version 0.9.0, I've
implemented the following methods to make that transition easier:

* #clear
* #empty?
* #each_key
* #key? (alias #has_key?)
* #each_value
* #value? (alias #has_value?)
2014-01-16 00:54:27 +01:00
Mislav Marohnić
d30873c9fe Increase margin for timing assertion
Failed because delta was 0.03097:
https://travis-ci.org/lostisland/faraday/jobs/16672600
2014-01-09 10:46:42 -08:00
Mislav Marohnić
362baf728e Avoid Ruby 2.1.0 crash due to Excon bug when connection is failed
geemus/excon#358
2014-01-09 10:23:22 -08:00
Erik Michaels-Ober
edcd7d61f3 Make formatting of then, yield, and super consistent 2014-01-09 02:59:12 +01:00
rick
6243f16b9b KeyError doesn't exist on 1.8.7 2013-11-09 08:42:15 -07:00
risk danger olson
02f8d48bb5 Merge pull request #296 from timgaleckas/master
Add backoff and randomness to retry middleware
2013-11-08 17:52:44 -08:00
risk danger olson
d52c4996aa make Faraday::Options#fetch more like Hash#fetch 2013-11-08 14:18:06 -07:00
risk danger olson
677bb46453 stop shadowing Faraday::Options 2013-11-08 13:53:01 -07:00
Tim Galeckas
80eacae193 change interval randomness to be expressed as an float percentage 2013-11-08 14:41:34 -06:00
risk danger olson
1b94e96022 Merge branch 'master' of https://github.com/benburkert/faraday into default-fetch-fixes 2013-11-08 13:33:40 -07:00
risk danger olson
1b43a1c16a add a few build_exclusive_url and build_url tests 2013-11-08 13:17:52 -07:00
risk danger olson
67d3cbf454 not testing build_url anywhere, update test names 2013-11-08 13:10:43 -07:00
Ben Burkert
7d0defae6e
Options#fetch should not return the default for false or nil values. 2013-10-16 11:45:45 -07:00
risk danger olson
0188ada941 don't require things twice now that autoload is default.
removes require lines added by some jackass in
d0437a1cb42f74b865bcf5fa6111d77b72a88688
2013-10-14 08:59:39 -06:00
risk danger olson
c9c1c4c23e allow custom env keys in an embedded hash 2013-10-13 11:16:39 -06:00
Mislav Marohnić
7dff04854e Make Headers#fetch case-insensitive
Matches the behavior of `[]` and `[]=` methods. Also accepts symbols:

    headers.fetch(:content_type)
2013-10-06 16:10:28 +02:00
Tim Galeckas
86663ca8fb give better failure messages for between checks 2013-08-29 22:50:43 -05:00
Tim Galeckas
5cb4a38495 divorce the testing of sleep_amount from Time.now 2013-08-29 22:30:36 -05:00
Tim Galeckas
37bd330979 Add backoff and randomness to retry middleware 2013-08-29 14:43:11 -05:00
Rafael Mendonça França
0adc6c69b2 Get the default values for the instrumenter options 2013-08-05 16:28:21 -03:00
Mislav Marohnić
010f81976f skip SSL peer verification test for Patron 2013-07-27 14:38:20 +02:00
Mislav Marohnić
4ac193943b wrap OpenSSL exceptions in Faraday's own SSLError class 2013-07-27 14:38:20 +02:00
Mislav Marohnić
7380ffc137 bump multipart-post dependency for Ruby 2.0 compatibility 2013-07-27 00:29:46 +02:00
Mislav Marohnić
9427063d97 hack HTTPClient to enable proxy integration tests
HTTPClient considers "localhost" to always be on a no-proxy list, thus
disabling our attempts to have integration tests on localhost. We
override its NO_PROXY_HOSTS constant during tests.
2013-07-27 00:29:45 +02:00
Mislav Marohnić
0a1deaf173 add integration tests for HTTP proxy support
Spins up a proxy server in a separate process, runs a few requests
through it with each adapter to verify that both proxy support and basic
authentication take effect.
2013-07-27 00:29:44 +02:00
Mislav Marohnić
9c7eb9c643 enable hash-style access to special Options properties
Makes these equivalent:

  options[:request] == options.request
  proxy[:password] == proxy.password
2013-07-27 00:29:44 +02:00
Mislav Marohnić
f28bf056cf ensure consistent handling of connection failures
All adapters should now raise Faraday::Error::ConnectionFailed
2013-07-27 00:29:41 +02:00
Mislav Marohnić
cff8dded75 add "http://" scheme to ENV['http_proxy'] value if missing
This allows:

    http_proxy=localhost:8888 ruby myscript.rb

Omitting the scheme is already supported by curl, and this matches that
behavior.
2013-07-27 00:29:41 +02:00
Lloyd
4488ce523e fix multipart post for servers that choke on Content-Type
Some servers such as Exchange 2010 don't like that there isn't a space
after a semicolon separator in the Content-Type request header. Since
Net::HTTPHeader#set_content_type adds the space, as well as it appearing
in the examples of RFC 2616, this follows suit and adds a space which
should help bad-behaving servers and not harm others.
2013-07-12 13:01:03 +02:00
Steve Agalloco
853b874480 use an array instead of a hash for testing pretty_inspect of objects 2013-07-05 11:42:26 -04:00
Steve Agalloco
fb6ed87714 added options hash to Logger to support logging bodies 2013-07-05 11:42:26 -04:00