excon 0.90.0 → 0.99.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6514f6e331e286e8c6c8f022eee9e79a9483b28ff9e218aa10ea9e0dd63a1f5c
4
- data.tar.gz: b58f6111c8f93dd0c5f625e727b065830467d8c61b6880767e878b88642e63bf
3
+ metadata.gz: 4de69b0df9a1fc68f382e6d007845ddd9dac6ec8e6f0150b0988caafc604fc66
4
+ data.tar.gz: 3735d61f7219a99bfcfd8f953c7dd16f66b0232a794c602042f30a7eda7c9334
5
5
  SHA512:
6
- metadata.gz: eb9ca062b32869a3c1ea826f3888f310a4dde0bff6a1bfb85a7c12f7b8efe349027961f0d44ca4f1f67e12711ba586a1c866c70bd45dbf6cad8e99c407312a1d
7
- data.tar.gz: 0e8897cd518e4e0153681e2e8f05baceb6c4186ce52d8c4bc9128d0622a15506c225505dd4d7cd1252a05d8d000833c44a2a06c5bde7494e30f8a721ac6cf659
6
+ metadata.gz: 366bb5af60bbd24b607bb9306a5f1581e0daeb95881e33376e85a9a7892935758fb06c09d656f27ffd3f791fbcc372e9703bf738f08a10c5d46f06558a34e19e
7
+ data.tar.gz: a38b16b4e9fe30c66d75e96e39330f6661a3c4a906801e7eaade9c3efd4af8d86a804b224d264f777f8d13026c0c1dc18581120ce179c5bfd6cf8ae3e427cd10
data/CONTRIBUTORS.md CHANGED
@@ -1,140 +1,182 @@
1
- * Aaron Stone <aaron@serendipity.cx>
2
- * Adam Esterline <adam@esterlines.com>
3
- * Alexander Sandström <alexander@skovik.com>
4
- * Andrew Katz <andrew.katz@outright.com>
5
- * Andy Delcambre <adelcambre@gmail.com>
6
- * Anshul Khandelwal <anshul@anshulkhandelwal.com>
7
- * Ash Wilson <smashwilson@gmail.com>
8
- * Ben Burkert <ben@benburkert.com>
9
- * Benedikt Böhm <bb@xnull.de>
10
- * Bo Jeanes <me@bjeanes.com>
11
- * Brandur <brandur@mutelight.org>
12
- * Brian D. Burns <iosctr@gmail.com>
13
- * Brian Hartsock <brian.hartsock@gmail.com>
14
- * Bryan Paxton <starbelly@pobox.com>
15
- * Caio Chassot <dev@caiochassot.com>
16
- * Caius Durling <dev@caius.name>
17
- * Carl Hörberg <carl.hoerberg@gmail.com>
18
- * Carl Hörberg <carl.hoerberg@gmail.com>
19
- * Carlos Sanchez <csanchez@maestrodev.com>
20
- * Casper Thomsen <ct@clearhaus.com>
21
- * Chris Hanks <christopher.m.hanks@gmail.com>
22
- * Claudio Poli <masterkain@gmail.com>
23
- * Damien Mathieu <damien@heroku.com>
24
- * Dan Hensgen <dan@methodhead.com>
25
- * Dan Peterson <dpiddy@gmail.com>
26
- * Dan Prince <dprince@redhat.com>
27
- * Dane Harrigan <dane.harrigan@gmail.com>
28
- * Dave Myron <therealdave.myron@gmail.com>
29
- * Dave Newton <davelnewton@gmail.com>
30
- * David Biehl <dbiehl@ncmedical.com>
31
- * David Biehl <lazylodr@gmail.com>
32
- * Dimitrij Denissenko <dimitrij@blacksquaremedia.com>
33
- * Dominik Richter <dominik.richter@gmail.com>
34
- * Doug McInnes <doug@dougmcinnes.com>
35
- * Eugene Howe <eugene@xtreme-computers.net>
36
- * Evan Phoenix <evan@fallingsnow.net>
37
- * Fabian Wiesel <fabian.wiesel@sap.com>
38
- * Federico Ravasio <ravasio.federico@gmail.com>
39
- * Glenn Pratt <glennpratt@gmail.com>
40
- * Graeme Nelson <graeme.nelson@gmail.com>
41
- * Guillaume Balaine <igosuki@gmail.com>
42
- * Hakan Ensari <hakan.ensari@papercavalier.com>
43
- * Ian Neubert <ian@ianneubert.com>
44
- * Jacob Atzen <jacob@incremental.dk>
45
- * James Cox <james@imaj.es>
46
- * James Watling <watling.james@gmail.com>
47
- * Jean Mertz <jean@mertz.fm>
48
- * Jeremy Hinegardner <jeremy@copiousfreetime.org>
49
- * Jesse Kempf <jesse.kempf@opower.com>
50
- * Joe Rafaniello <jrafanie@redhat.com>
51
- * John Keiser <jkeiser@opscode.com>
52
- * John Leach <john@brightbox.co.uk>
53
- * Jonas Pfenniger <jonas@pfenniger.name>
54
- * Jonathan Dance <github@wuputah.com>
55
- * Jonathan Dance <jd@wuputah.com>
56
- * Jonathan Roes <jroes@jroes.net>
57
- * Joshua B. Smith <jbsmith@us.ibm.com>
58
- * Joshua Gross <joshua@surfeasy.com>
59
- * Joshua Mckinney <joshmckin@gmail.com>
60
- * Joshua Napoli <jnapoli@swipely-napoli.home>
61
- * Joshua Napoli <jnapoli@swipely-napoli.local>
62
- * Kelly Mahan <kmahan@kmahan.com>
63
- * Kensuke Nagae <kyanny@gmail.com>
64
- * Konstantin Shabanov <etehtsea@gmail.com>
65
- * Kyle Rames <kyle.rames@rackspace.com>
66
- * Lewis Marshall <lewis@lmars.net>
67
- * Lincoln Stoll <me@lstoll.net>
68
- * Louis Sobel <sobel@mit.edu>
69
- * Mahemoff <michael@mahemoff.com>
70
- * Mathias Meyer <meyer@paperplanes.de>
71
- * Matt Gauger <matt.gauger@gmail.com>
72
- * Matt Sanders <matt@modal.org>
73
- * Matt Sanders <matt@polycot.com>
74
- * Matt Snyder <snyder2112@me.com>
75
- * Matt Todd <chiology@gmail.com>
76
- * Max Lincoln <max@devopsy.com>
77
- * Michael Brodhead <mkb@engineyard.com>
78
- * Michael Hale <mike@hales.ws>
79
- * Michael Rowe <mrowe@mojain.com>
80
- * Michael Rykov <mrykov@gmail.com>
81
- * Mike Heffner <mikeh@fesnel.com>
82
- * Myron Marston <myron.marston@gmail.com>
83
- * Nathan Long <nathan.long@tma1.com>
84
- * Nathan Sutton <nate@zencoder.com>
85
- * Nick Osborn <nick.osborn@digital.cabinet-office.gov.uk>
86
- * Nicolas Sanguinetti <contacto@nicolassanguinetti.info>
87
- * Paul Gideon Dann <pdgiddie@gmail.com>
88
- * Pavel <pavel.evst@gmail.com>
89
- * Peter Meier <peter.meier@immerda.ch>
90
- * Peter Weldon <peter.weldon@null.net>
91
- * Peter Weldon <peter@lautus.net>
92
- * Phil Ross <phil.ross@gmail.com>
93
- * Richard Ramsden <richard@rramsden.ca>
94
- * Ruslan Korolev <rs3@fastmail.com>
95
- * Ruslan Korolev <rs41@gmx.com>
96
- * Ruslan Kyrychuk <ruslan.kyrychuk@gmail.com>
97
- * Ryan Bigg <radarlistener@fastmail.fm>
98
- * Ryan Mohr <ryan.mohr@gmail.com>
99
- * Sam Withrow <sam.withrow@curiousnation.org>
100
- * Scott Gonyea <me@aitrus.org>
101
- * Scott Gonyea <me@sgonyea.com>
102
- * Scott Walkinshaw <scott.walkinshaw@gmail.com>
103
- * Sean Cribbs <seancribbs@gmail.com>
104
- * Sergio Rubio <rubiojr@frameos.org>
105
- * Shai Rosenfeld <shaiguitar@gmail.com>
106
- * Stefan Merettig <stefan-merettig@nuriaproject.org>
107
- * Stephen Chu <github@stephenchu.com>
108
- * Swanand Pagnis <swanandp@users.noreply.github.com>
109
- * Terry Howe <terrylhowe@gmail.com>
110
- * Thom Mahoney & Josh Lane <tmahoney@engineyard.com>
111
- * Thom May <thom@digital-science.com>
112
- * Tim Carey-Smith <tim@spork.in>
113
- * Todd Lunter <tlunter@gmail.com>
114
- * Tom Maher <tmaher@heroku.com>
115
- * Tom Maher <tmaher@tursom.org>
116
- * Trym Skaar <trym@tryms.no>
117
- * Tuomas Silen <tuomas.silen@nodeta.fi>
118
- * Victor Costan <costan@gmail.com>
119
- * Viven <vivien.schilis@gmail.com>
120
- * Wesley Beary <geemus+github@gmail.com>
121
- * Wesley Beary <geemus@engineyard.com>
122
- * Wesley Beary <geemus@gmail.com>
123
- * Wesley Beary <wbeary@engineyard.com>
124
- * Wesley Beary <wesley@heroku.com>
125
- * Zach Anker <zanker@squareup.com>
126
- * chrisrhoden <carhoden@gmail.com>
127
- * dickeyxxx <jeff@dickeyxxx.com>
128
- * geemus (Wesley Beary) <wbeary@engineyard.com>
129
- * geemus <geemus@gmail.com>
130
- * ggoodale <ggoodale@gmail.com>
131
- * marios <marios@redhat.com>
132
- * mkb <mkb@black-ice.org>
133
- * phiggins <pete@peterhiggins.org>
134
- * rin_ne <rinrin.ne@gmail.com>
135
- * rinrinne <rinrin.ne@gmail.com>
136
- * rkyrychuk <ruslan.kyrychuk@gmail.com>
137
- * sshaw <skye.shaw@gmail.com>
138
- * starbelly <starbelly@pobox.com>
139
- * twrodriguez <tw.rodriguez@gmail.com>
140
- * zimbatm <zimbatm@zimbatm.com>
1
+ * Aaron Stone
2
+ * Adam Avilla
3
+ * Adam Esterline
4
+ * Alexander Sandström
5
+ * Alexandr Burov
6
+ * Andrew Katz
7
+ * Andrew Metcalf
8
+ * Andrew Sullivan Cant
9
+ * André Diego Piske
10
+ * Andy Delcambre
11
+ * Anshul Khandelwal
12
+ * Anton Chuchkalov
13
+ * Antonio Terceiro
14
+ * Ash Wilson
15
+ * Atul Bhosale
16
+ * Bart de Water
17
+ * Ben Burkert
18
+ * Benedikt Böhm
19
+ * Bill Mill
20
+ * Bo Jeanes
21
+ * Brandur
22
+ * Brian D. Burns
23
+ * Brian Hartsock
24
+ * Bryan Paxton
25
+ * Caio Chassot
26
+ * Caius Durling
27
+ * Carl Hörberg
28
+ * Carl Hörberg
29
+ * Carlos Sanchez
30
+ * Casper Thomsen
31
+ * Chris Hanks
32
+ * Christoph Rieß
33
+ * Christophe Taton
34
+ * Claudio Poli
35
+ * Craig Shannon
36
+ * Damien Mathieu
37
+ * Dan Hensgen
38
+ * Dan Peterson
39
+ * Dan Prince
40
+ * Dane Harrigan
41
+ * Daniel Berger
42
+ * Dave Myron
43
+ * Dave Newton
44
+ * Dave Vasilevsky
45
+ * David Biehl
46
+ * David Taylor
47
+ * Dimitrij Denissenko
48
+ * Dominik Richter
49
+ * Doug McInnes
50
+ * Esteban Pastorino
51
+ * Eugene Howe
52
+ * Evan Phoenix
53
+ * Fabian Wiesel
54
+ * Federico Ravasio
55
+ * Felix Wolfsteller
56
+ * Glenn Pratt
57
+ * Graeme Nelson
58
+ * Grey Baker
59
+ * Guillaume Balaine
60
+ * Hakan Ensari
61
+ * Hiroshi Hatake
62
+ * Ian Neubert
63
+ * Igor Fedoronchuk
64
+ * Jacob Atzen
65
+ * James Cox
66
+ * James Watling
67
+ * Jean Mertz
68
+ * Jeremy Hinegardner
69
+ * Jesse Kempf
70
+ * Jessica Jiang
71
+ * Joe Rafaniello
72
+ * John Keiser
73
+ * John Leach
74
+ * Jonas Pfenniger
75
+ * Jonathan Dance
76
+ * Jonathan Roes
77
+ * Joshua B. Smith
78
+ * Joshua Gross
79
+ * Joshua Mckinney
80
+ * Joshua Napoli
81
+ * Kelly Mahan
82
+ * Kensuke Nagae
83
+ * Kimmo Lehto
84
+ * Koen Rouwhorst
85
+ * Konstantin Shabanov
86
+ * Kyle Purkiss
87
+ * Kyle Rames
88
+ * Lewis Marshall
89
+ * Lincoln Stoll
90
+ * Louis Sobel
91
+ * Mahemoff
92
+ * Marco Costa
93
+ * Markus Bucher
94
+ * Mathias Meyer
95
+ * Matt Gauger
96
+ * Matt Palmer
97
+ * Matt Sanders
98
+ * Matt Snyder
99
+ * Matt Todd
100
+ * Maurice Schreiber
101
+ * Max Lincoln
102
+ * Michael Brodhead
103
+ * Michael Hale
104
+ * Michael Rowe
105
+ * Michael Rykov
106
+ * Mike Heffner
107
+ * Milovan Zogovic
108
+ * Myron Marston
109
+ * Nathan Long
110
+ * Nathan Sutton
111
+ * Nick Osborn
112
+ * Nicolas Leger
113
+ * Nicolas Sanguinetti
114
+ * Paul Gideon Dann
115
+ * Pavel
116
+ * Pavel Valena
117
+ * Peter Meier
118
+ * Peter Weldon
119
+ * Phil Ross
120
+ * Raul Murciano
121
+ * Richard Godbee
122
+ * Richard Ramsden
123
+ * Rohan Mendon
124
+ * Ruslan Korolev
125
+ * Ruslan Kyrychuk
126
+ * Ryan Bigg
127
+ * Ryan Mohr
128
+ * Ryan Schlesinger
129
+ * Ryoji Yoshioka
130
+ * Sam
131
+ * Sam Lehman
132
+ * Sam Withrow
133
+ * Scott Gonyea
134
+ * Scott Walkinshaw
135
+ * Sean Cribbs
136
+ * Sergio Rubio
137
+ * Shai Rosenfeld
138
+ * Stan Hu
139
+ * Stefan Merettig
140
+ * Stephen Chu
141
+ * Swanand Pagnis
142
+ * Terry Howe
143
+ * Thom Mahoney & Josh Lane
144
+ * Thom May
145
+ * Tim Carey-Smith
146
+ * Timothée Peignier
147
+ * Tobias Schmidt
148
+ * Todd Lunter
149
+ * Tom Maher
150
+ * Trym Skaar
151
+ * Tuomas Silen
152
+ * Victor Costan
153
+ * Viven
154
+ * Vít Ondruch
155
+ * Wesley Beary
156
+ * Yusuke Nakamura
157
+ * Zach Anker
158
+ * chrisrhoden
159
+ * dependabot[bot]
160
+ * dickeyxxx
161
+ * geemus
162
+ * geemus (Wesley Beary)
163
+ * ggoodale
164
+ * ivan.filenko
165
+ * jasquat
166
+ * karimb
167
+ * marios
168
+ * mkb
169
+ * nathannaveen
170
+ * ojab
171
+ * patrick brisbin
172
+ * pavel
173
+ * phiggins
174
+ * rin_ne
175
+ * rinrinne
176
+ * rkyrychuk
177
+ * shale
178
+ * sshaw
179
+ * starbelly
180
+ * twrodriguez
181
+ * wsnarski
182
+ * zimbatm
data/README.md CHANGED
@@ -7,22 +7,22 @@ Excon was designed to be simple, fast and performant. It works great as a genera
7
7
  [![Build Status](https://github.com/excon/excon/actions/workflows/ruby.yml/badge.svg)](https://github.com/excon/excon/actions/workflows/ruby.yml)
8
8
  [![Gem Version](https://badge.fury.io/rb/excon.svg)](https://badge.fury.io/rb/excon)
9
9
 
10
- * [Getting Started](#getting-started)
11
- * [Options](#options)
12
- * [Chunked Requests](#chunked-requests)
13
- * [Pipelining Requests](#pipelining-requests)
14
- * [Streaming Responses](#streaming-responses)
15
- * [Proxy Support](#proxy-support)
16
- * [Reusable ports](#reusable-ports)
17
- * [Unix Socket Support](#unix-socket-support)
18
- * [Stubs](#stubs)
19
- * [Instrumentation](#instrumentation)
20
- * [HTTPS client certificate](#https-client-certificate)
21
- * [HTTPS/SSL Issues](#httpsssl-issues)
22
- * [Getting Help](#getting-help)
23
- * [Contributing](#contributing)
24
- * [Plugins and Middlewares](#plugins-and-middlewares)
25
- * [License](#license)
10
+ - [Getting Started](#getting-started)
11
+ - [Options](#options)
12
+ - [Chunked Requests](#chunked-requests)
13
+ - [Pipelining Requests](#pipelining-requests)
14
+ - [Streaming Responses](#streaming-responses)
15
+ - [Proxy Support](#proxy-support)
16
+ - [Reusable ports](#reusable-ports)
17
+ - [Unix Socket Support](#unix-socket-support)
18
+ - [Stubs](#stubs)
19
+ - [Instrumentation](#instrumentation)
20
+ - [HTTPS client certificate](#https-client-certificate)
21
+ - [HTTPS/SSL Issues](#httpsssl-issues)
22
+ - [Getting Help](#getting-help)
23
+ - [Contributing](#contributing)
24
+ - [Plugins and Middlewares](#plugins-and-middlewares)
25
+ - [License](#license)
26
26
 
27
27
  ## Getting Started
28
28
 
@@ -92,7 +92,6 @@ connection.get # socket reused
92
92
  Note that sending a request with `:persistent => false` to close the socket will also send `Connection: close` to inform
93
93
  the server the connection is no longer needed. `Connection#reset` will simply close our end of the socket.
94
94
 
95
-
96
95
  ## Options
97
96
 
98
97
  Both one-off and persistent connections support many other options. The final options for a request are built up by starting with `Excon.defaults`, then merging in options from the connection and finally merging in any request options. In this way you have plenty of options on where and how to set options and can easily setup connections or defaults to match common options for a particular endpoint.
@@ -101,7 +100,7 @@ Here are a few common examples:
101
100
 
102
101
  ```ruby
103
102
  # Output debug info, similar to ENV['EXCON_DEBUG']
104
- connection = Excon.new('http://geemus.com/', :debug_request => true, :debug_response => true)
103
+ connection = Excon.new('http://geemus.com/', :debug => true)
105
104
 
106
105
  # Custom headers
107
106
  Excon.get('http://geemus.com', :headers => {'Authorization' => 'Basic 0123456789ABCDEF'})
@@ -128,6 +127,38 @@ connection.request(:method => 'GET')
128
127
  # expect one or more status codes, or raise an error
129
128
  connection.request(:expects => [200, 201], :method => :get)
130
129
 
130
+ # use basic authentication by supplying credentials in the URL or as parameters
131
+ connection = Excon.new('http://username:password@secure.geemus.com')
132
+ # Note: username & password is unescaped for request, so you should provide escaped values here
133
+ # i. e. instead of `password: 'pa%%word'` you should use `password: Excon::Utils.escape_uri('pa%%word')`,
134
+ # which return `pa%25%25word`
135
+ connection = Excon.new('http://secure.geemus.com',
136
+ :user => 'username', :password => 'password')
137
+
138
+ # use custom uri parser
139
+ require 'addressable/uri'
140
+ connection = Excon.new('http://geemus.com/', uri_parser: Addressable::URI)
141
+ ```
142
+
143
+ Compared to web browsers and other http client libraries, e.g. curl, Excon is a bit more low-level and doesn't assume much by default. If you are seeing different results compared to other clients, the following options might help:
144
+
145
+ ```ruby
146
+ # opt-in to omitting port from http:80 and https:443
147
+ connection = Excon.new('http://geemus.com/', :omit_default_port => true)
148
+
149
+ # accept gzip encoding
150
+ connection = Excon.new('http://geemus.com/', :headers => { "Accept-Encoding" => "gzip" })
151
+
152
+ # turn off peer verification (less secure)
153
+ Excon.defaults[:ssl_verify_peer] = false
154
+ connection = Excon.new('https://...')
155
+ ```
156
+
157
+ ## Timeouts and Retries
158
+
159
+ You can modify timeouts and define whether and how many (blocking) retries Excon should attempt if errors occur.
160
+
161
+ ```ruby
131
162
  # this request can be repeated safely, so retry on errors up to 4 times
132
163
  connection.request(:idempotent => true)
133
164
 
@@ -138,6 +169,10 @@ connection.request(:idempotent => true, :retry_limit => 6)
138
169
  # in between each retry
139
170
  connection.request(:idempotent => true, :retry_limit => 6, :retry_interval => 5)
140
171
 
172
+ # specify the errors on which to retry (default Timeout, Socket, HTTPStatus)
173
+ # only retry on timeouts
174
+ connection.request(:idempotent => true, :retry_limit => 6, :retry_interval => 5, :retry_errors => [Excon::Error::Timeout] )
175
+
141
176
  # set longer read_timeout (default is 60 seconds)
142
177
  connection.request(:read_timeout => 360)
143
178
 
@@ -156,32 +191,6 @@ connection = Excon.new('http://geemus.com/', :connect_timeout => 360)
156
191
 
157
192
  # opt-out of nonblocking operations for performance and/or as a workaround
158
193
  connection = Excon.new('http://geemus.com/', :nonblock => false)
159
-
160
- # use basic authentication by supplying credentials in the URL or as parameters
161
- connection = Excon.new('http://username:password@secure.geemus.com')
162
- # Note: username & password is unescaped for request, so you should provide escaped values here
163
- # i. e. instead of `password: 'pa%%word'` you should use `password: Excon::Utils.escape_uri('pa%%word')`,
164
- # which return `pa%25%25word`
165
- connection = Excon.new('http://secure.geemus.com',
166
- :user => 'username', :password => 'password')
167
-
168
- # use custom uri parser
169
- require 'addressable/uri'
170
- connection = Excon.new('http://geemus.com/', uri_parser: Addressable::URI)
171
- ```
172
-
173
- Compared to web browsers and other http client libraries, e.g. curl, Excon is a bit more low-level and doesn't assume much by default. If you are seeing different results compared to other clients, the following options might help:
174
-
175
- ```ruby
176
- # opt-in to omitting port from http:80 and https:443
177
- connection = Excon.new('http://geemus.com/', :omit_default_port => true)
178
-
179
- # accept gzip encoding
180
- connection = Excon.new('http://geemus.com/', :headers => { "Accept-Encoding" => "gzip" })
181
-
182
- # turn off peer verification (less secure)
183
- Excon.defaults[:ssl_verify_peer] = false
184
- connection = Excon.new('https://...')
185
194
  ```
186
195
 
187
196
  ## Chunked Requests
@@ -277,7 +286,7 @@ s.close
277
286
 
278
287
  ## Unix Socket Support
279
288
 
280
- The Unix socket will work for one-off requests and multiuse connections. A Unix socket path must be provided separate from the resource path.
289
+ The Unix socket will work for one-off requests and multiuse connections. A Unix socket path must be provided separate from the resource path.
281
290
 
282
291
  ```ruby
283
292
  connection = Excon.new('unix:///', :socket => '/tmp/unicorn.sock')
@@ -309,7 +318,19 @@ Excon.stub({}, {:body => 'body', :status => 200})
309
318
  Excon.stub({}, lambda {|request_params| {:body => request_params[:body], :status => 200}})
310
319
  ```
311
320
 
312
- Omitted attributes are assumed to match, so this stub will match *any* request and return an Excon::Response with a body of 'body' and status of 200. You can add whatever stubs you might like this way and they will be checked against in the order they were added, if none of them match then excon will raise an `Excon::Errors::StubNotFound` error to let you know.
321
+ Omitted attributes are assumed to match, so this stub will match _any_ request and return an Excon::Response with a body of 'body' and status of 200.
322
+
323
+ ```ruby
324
+ Excon.stub({ :scheme => 'https', :host => 'example.com', :path => /\/examples\/\d+/, :port => 443 }, { body: 'body', status: 200 })
325
+ ```
326
+
327
+ The above code will stub this:
328
+
329
+ ```ruby
330
+ Excon.get('https://example.com/examples/123', mock: true)
331
+ ```
332
+
333
+ You can add whatever stubs you might like this way and they will be checked against in the order they were added, if none of them match then excon will raise an `Excon::Errors::StubNotFound` error to let you know.
313
334
 
314
335
  If you want to allow unstubbed requests without raising `StubNotFound`, set the `allow_unstubbed_requests` option either globally or per request.
315
336
 
@@ -356,7 +377,7 @@ connection = Excon.new(
356
377
  )
357
378
  ```
358
379
 
359
- Excon will then instrument each request, retry, and error. The corresponding events are named `excon.request`, `excon.retry`, and `excon.error` respectively.
380
+ Excon will then instrument each request, retry, and error. The corresponding events are named `excon.request`, `excon.retry`, and `excon.error` respectively.
360
381
 
361
382
  ```ruby
362
383
  ActiveSupport::Notifications.subscribe(/excon/) do |*args|
@@ -410,7 +431,7 @@ The #instrument method will be called for each HTTP request, response, retry, an
410
431
 
411
432
  For debugging purposes you can also use `Excon::StandardInstrumentor` to output all events to stderr. This can also be specified by setting the `EXCON_DEBUG` ENV var.
412
433
 
413
- See [the documentation for ActiveSupport::Notifications](http://api.rubyonrails.org/classes/ActiveSupport/Notifications.html) for more detail on using the subscription interface. See excon's [instrumentation_test.rb](https://github.com/excon/excon/blob/master/tests/middlewares/instrumentation_tests.rb) for more examples of instrumenting excon.
434
+ See [the documentation for ActiveSupport::Notifications](http://api.rubyonrails.org/classes/ActiveSupport/Notifications.html) for more detail on using the subscription interface. See excon's [instrumentation_test.rb](https://github.com/excon/excon/blob/master/tests/middlewares/instrumentation_tests.rb) for more examples of instrumenting excon.
414
435
 
415
436
  ## HTTPS client certificate
416
437
 
@@ -425,7 +446,16 @@ connection = Excon.new('https://example.com',
425
446
 
426
447
  `client_key_pass` is optional.
427
448
 
428
- If you already have loaded the certificate and key into memory, then pass it through like:
449
+ Optionally, you can also pass the whole chain by passing the extra certificates through `client_chain`:
450
+
451
+ ```ruby
452
+ connection = Excon.new('https://example.com',
453
+ client_cert: 'mycert.pem',
454
+ client_chain: 'mychain.pem',
455
+ client_key: 'mycert.key')
456
+ ```
457
+
458
+ If you already have loaded the certificate, key and chain into memory, then pass it through like:
429
459
 
430
460
  ```ruby
431
461
  client_cert_data = File.load 'mycert.pem'
@@ -433,6 +463,7 @@ client_key_data = File.load 'mycert.key'
433
463
 
434
464
  connection = Excon.new('https://example.com',
435
465
  client_cert_data: client_cert_data,
466
+ client_chain_data: client_chain_data,
436
467
  client_key_data: client_key_data)
437
468
  ```
438
469
 
@@ -459,8 +490,8 @@ Either of these should allow you to work around the socket error and continue wi
459
490
 
460
491
  ## Getting Help
461
492
 
462
- * Ask specific questions on [Stack Overflow](http://stackoverflow.com/questions/tagged/excon).
463
- * Report bugs and discuss potential features in [Github issues](https://github.com/excon/excon/issues).
493
+ - Ask specific questions on [Stack Overflow](http://stackoverflow.com/questions/tagged/excon).
494
+ - Report bugs and discuss potential features in [Github issues](https://github.com/excon/excon/issues).
464
495
 
465
496
  ## Contributing
466
497
 
@@ -472,12 +503,12 @@ Using Excon's [Middleware system][middleware], you can easily extend Excon's
472
503
  functionality with your own. The following plugins extend Excon in their own
473
504
  way:
474
505
 
475
- * [excon-addressable](https://github.com/JeanMertz/excon-addressable)
506
+ - [excon-addressable](https://github.com/JeanMertz/excon-addressable)
476
507
 
477
508
  Set [addressable](https://github.com/sporkmonger/addressable) as the default
478
509
  URI parser, and add support for [URI templating][templating].
479
510
 
480
- * [excon-hypermedia](https://github.com/JeanMertz/excon-hypermedia)
511
+ - [excon-hypermedia](https://github.com/JeanMertz/excon-hypermedia)
481
512
 
482
513
  Teaches Excon to talk with [HyperMedia APIs][hypermedia]. Allowing you to use
483
514
  all of Excon's functionality, while traversing APIs in an easy and