contractful 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. checksums.yaml +7 -0
  2. data/API.md +142 -0
  3. data/ARCHITECTURE.md +134 -0
  4. data/AUTHORS +106 -0
  5. data/CODE_OF_CONDUCT.md +128 -0
  6. data/LICENSE +21 -0
  7. data/README.md +1290 -0
  8. data/SECURITY.md +67 -0
  9. data/bin/contractful +128 -0
  10. data/history.md +801 -0
  11. data/lib/contractful/abstract_response.rb +301 -0
  12. data/lib/contractful/circuit_breaker.rb +221 -0
  13. data/lib/contractful/connection_pool.rb +166 -0
  14. data/lib/contractful/contract/auth.rb +257 -0
  15. data/lib/contractful/contract/config.rb +93 -0
  16. data/lib/contractful/contract/definition.rb +295 -0
  17. data/lib/contractful/contract/dsl.rb +501 -0
  18. data/lib/contractful/contract/executor.rb +492 -0
  19. data/lib/contractful/contract/openapi_import.rb +1135 -0
  20. data/lib/contractful/contract/pagination.rb +218 -0
  21. data/lib/contractful/contract/param.rb +505 -0
  22. data/lib/contractful/contract/postman_import/auth.rb +39 -0
  23. data/lib/contractful/contract/postman_import/body.rb +87 -0
  24. data/lib/contractful/contract/postman_import/operation.rb +107 -0
  25. data/lib/contractful/contract/postman_import/scope.rb +37 -0
  26. data/lib/contractful/contract/postman_import/url.rb +80 -0
  27. data/lib/contractful/contract/postman_import.rb +164 -0
  28. data/lib/contractful/contract/response_field.rb +167 -0
  29. data/lib/contractful/contract/sequence.rb +432 -0
  30. data/lib/contractful/contract/swagger2/components.rb +84 -0
  31. data/lib/contractful/contract/swagger2/operations.rb +81 -0
  32. data/lib/contractful/contract/swagger2/parameters.rb +93 -0
  33. data/lib/contractful/contract/swagger2/references.rb +55 -0
  34. data/lib/contractful/contract/swagger2.rb +55 -0
  35. data/lib/contractful/contract.rb +85 -0
  36. data/lib/contractful/exceptions.rb +328 -0
  37. data/lib/contractful/notifications/active_support.rb +40 -0
  38. data/lib/contractful/notifications.rb +138 -0
  39. data/lib/contractful/pacer.rb +161 -0
  40. data/lib/contractful/params_array.rb +85 -0
  41. data/lib/contractful/payload.rb +340 -0
  42. data/lib/contractful/platform.rb +52 -0
  43. data/lib/contractful/rate_limit.rb +133 -0
  44. data/lib/contractful/raw_response.rb +70 -0
  45. data/lib/contractful/request.rb +1483 -0
  46. data/lib/contractful/resource.rb +189 -0
  47. data/lib/contractful/response.rb +109 -0
  48. data/lib/contractful/utils.rb +202 -0
  49. data/lib/contractful/version.rb +11 -0
  50. data/lib/contractful/windows/root_certs.rb +107 -0
  51. data/lib/contractful/windows.rb +9 -0
  52. data/lib/contractful.rb +233 -0
  53. metadata +244 -0
data/history.md ADDED
@@ -0,0 +1,801 @@
1
+ # 0.1.0
2
+
3
+ First release published as **contractful**. The version restarts at 0.1.0
4
+ because the gem name changed: the `rest-client` name on RubyGems belongs to
5
+ the original project this codebase modernized, and none of the versions
6
+ below were ever published under it. The code itself is the current master
7
+ line — same contracts, helpers and test suite — renamed:
8
+
9
+ * Automated GitHub Actions release workflow (`.github/workflows/release.yml`)
10
+ with TOTP MFA authentication, matching the DhanHQ release setup. Added
11
+ `allowed_push_host`, `source_code_uri`, and author email to `contractful.gemspec`,
12
+ along with an explicit allowlist for packaged gem files to omit specs and internal
13
+ tooling from published releases. Added `docs/RELEASE_GUIDE.md`.
14
+ * Added: a Postman Collection importer, `Contractful::Contract::PostmanImport`
15
+ (opt-in, `require 'contractful/contract/postman_import'`). It reads v2.0 and
16
+ v2.1 exports: folders flatten into one contract per request, `{{variables}}`
17
+ resolve from the collection and the caller, query keys and static headers
18
+ become params, and JSON, urlencoded and GraphQL bodies become params. Every
19
+ lossy mapping is reported on the notes. `Authorization` is never mapped to a
20
+ credential; collection auth becomes a commented hint.
21
+ * Added: the OpenAPI import helper accepts Swagger 2.0 documents. They are
22
+ converted to OpenAPI 3.0 before import: `host`, `basePath` and `schemes`
23
+ give the base URL, body and formData parameters give a request body, and
24
+ definitions, responses and `securityDefinitions` map across. Swagger 2.0
25
+ files bundled through `$ref` are converted as they are read. The `openapi:
26
+ 2.0` field is still rejected, because it is not a version.
27
+ * Added: the OpenAPI importer resolves `$ref`s into other local files when
28
+ the document is read from a file. Each referenced file is bundled once, and
29
+ refs inside it resolve relative to it. Circular references terminate. A
30
+ missing file raises `OpenAPIImport::Error`. Remote URLs are never fetched;
31
+ they stay unresolved and are reported on the notes.
32
+ * Added: `header:` and `cookie:` options on contract params. The value is sent
33
+ as that request header or cookie instead of in the query or payload. Scalar
34
+ types only; names must be HTTP tokens; a header value with control
35
+ characters or a cookie value outside RFC 6265 cookie-octets raises
36
+ `InvalidParam` before any traffic. The OpenAPI importer maps `in: header`
37
+ and `in: cookie` parameters to these options. Names that are not tokens and
38
+ non-scalar types stay on `import.notes`. `before_request` contexts gain a
39
+ `cookies:` key.
40
+ * Added: the OpenAPI importer flattens `allOf` compositions of object schemas
41
+ into one set of params or response fields, and unwraps a single scalar
42
+ `allOf` reference (common for enums with a description). Mixed `allOf`s are
43
+ still reported on `import.notes`.
44
+ * Fixed: a two-parameter `verify_response` block received `nil` when the body
45
+ was not JSON, so it could pass a response that was never parsed. It now
46
+ raises `UnexpectedResponse` and the block is not called.
47
+ * Fixed: a positive `:max_retries` on a non-idempotent request (POST, PATCH)
48
+ is refused with `ArgumentError` before any network traffic, unless the
49
+ request is declared `idempotent: true` (contracts: `idempotent true`, or a
50
+ pinned `_idempotency_key`). Previously a timed-out order POST was sent
51
+ twice. New `:idempotent` request option; GET, HEAD, OPTIONS, TRACE, PUT and
52
+ DELETE default to idempotent (RFC 9110).
53
+ * Fixed: on a contract with `auth token_provider:` and no `responds`, an
54
+ undeclared 4xx/5xx was returned as a value instead of raising. It now raises
55
+ the mapped exception (for example `InternalServerError`, or `Unauthorized`
56
+ when the refreshed token is still rejected), as it does on every other
57
+ contract.
58
+ * Fixed: `Integer` params read digit strings with `Kernel#Integer`, so `"010"`
59
+ silently became `8`. Strings are now read in base 10. `"08"` and non-finite
60
+ floats (`NaN`, infinities) raised a raw `ArgumentError` or `FloatDomainError`
61
+ instead of `InvalidParam`; they now raise `InvalidParam`.
62
+ * Fixed: the OpenAPI importer set `payload_style :form` for form-urlencoded
63
+ request bodies but mapped none of their properties, and reported nothing.
64
+ Generated clients raised `UnknownParam` for every body field (306 operations
65
+ in Stripe's 3.0 spec). The properties of a form-urlencoded body now become
66
+ params, as JSON body properties already did. When a request offers both
67
+ media types, the JSON body still supplies the params and the payload style.
68
+ * Fixed: a colon directly after a path placeholder was read as a second
69
+ placeholder. `POST /things/:id:archive` required a stray `archive` param and
70
+ expanded to `/things/5archive`, dropping the colon. The colon is now a literal
71
+ suffix, so it expands to `/things/5:archive`. Behavior change: a template
72
+ such as `/:year:month` now declares one placeholder with a literal `:month`
73
+ suffix; it previously declared two.
74
+ * Renamed the gem, the require path and the module: `rest-client` →
75
+ `contractful`, `require 'restclient'` → `require 'contractful'`,
76
+ `RestClient` → `Contractful`, and the CLI with it (`bin/contractful`).
77
+ The backward-compat entry shims (`rest-client.rb`, `rest_client.rb`) are
78
+ gone along with the old-name requires they existed for.
79
+ * `RESTCLIENT_LOG` → `CONTRACTFUL_LOG`.
80
+ * The GitHub repository moved to
81
+ [shubhamtaywade82/contractful](https://github.com/shubhamtaywade82/contractful);
82
+ old links redirect. Gemspec metadata, badges and the documentation set
83
+ point at the new location.
84
+ * References to the upstream rest-client repository — issue/PR links in
85
+ code comments and the heritage notes — deliberately keep pointing at the
86
+ original project.
87
+ * The unit suite now runs under simplecov and enforces a 95% line-coverage
88
+ minimum on `lib/` as CI gate G13 (the `windows/` platform shims and
89
+ `version.rb` — which Bundler evaluates before a coverage tracer can
90
+ attach — are filtered with the cause documented in `spec/spec_helper.rb`).
91
+ Closing the measured gaps added edge-branch specs for `Param` coercion and
92
+ the OpenAPI import, and surfaced two latent defects that are fixed here:
93
+ the `Param` Kernel-cast fallback crashed with `NoMethodError` on anonymous
94
+ classes (now cleanly rejected with `InvalidParam`), and the OpenAPI
95
+ renderer's "cannot render a Proc default" guard was dead code because
96
+ `Param#default_value` resolves procs — the guard now keys off the new
97
+ `Param#lazy_default?` predicate.
98
+ * The gem now ships YARD API documentation: `.yardopts` configures the
99
+ rendering (markdown, README/history as narrative files, protected
100
+ methods included), the `Contractful` facade module carries a proper
101
+ overview doc, and the gemspec links `documentation_uri` to rubydoc.info.
102
+ `yard` and `redcarpet` are development-only gems.
103
+
104
+ * Post request lifecycle events to a new `Contractful::Notifications` hub
105
+ (`request`, `response`, `retry` — method, url, attempt, status,
106
+ duration_ms, retry cause). Thread-safe; a raising subscriber is logged
107
+ and skipped so observability cannot break the request it observes. An
108
+ opt-in `contractful/notifications/active_support` bridge re-posts every
109
+ event to ActiveSupport::Notifications as `contractful.<name>`;
110
+ activesupport is a test-only dependency, never a runtime one.
111
+ * Randomize computed retry backoff with `retry_jitter: :full`, `:equal` or
112
+ `:decorrelated` (AWS recipe, capped by `retry_jitter_cap`) so fleets of
113
+ clients do not retry in lockstep; a server's Retry-After is honored
114
+ exactly, and `retry_rng` accepts a seeded Random for deterministic
115
+ tests. Contract clients pass the options through as
116
+ `_retry_jitter`/`_retry_jitter_cap`/`_retry_rng`.
117
+ * Add an opt-in host-level circuit breaker (`breaker: true` or a config
118
+ Hash): consecutive failure requests — network errors and retryable
119
+ statuses after retries are exhausted — open a process-wide
120
+ scheme/host/port circuit that fails fast with
121
+ `Contractful::CircuitOpenError` for the cooldown, then half-open probes.
122
+ 4xx responses never open a circuit. Transitions post `circuit`
123
+ notifications; contract clients pass `_breaker` per call.
124
+ * Add proactive rate-limit pacing (`pace: true` or a config Hash): a
125
+ process-wide sliding window per scheme/host/port delays requests that
126
+ would exceed a configured quota instead of eating 429s — waits post
127
+ `pace` notifications and a wait beyond `max_wait` raises
128
+ `PacingTimeout`. Contract clients pass `_pace` per call.
129
+ * Add OAuth-style token-provider auth (`auth token_provider:`): the
130
+ provider answers `#token` and `#refresh`; on a 401 the executor
131
+ refreshes it in one flight (concurrent 401s share a single refresh)
132
+ and retries exactly once with the fresh credential.
133
+
134
+ Review follow-up (second pass over the request pipeline and contract layer):
135
+
136
+ * Redirects now strip `Authorization`, `Proxy-Authorization` and `Cookie`
137
+ headers when the origin changes, and refuse HTTPS→HTTP downgrades, so
138
+ credentials cannot follow a redirect to a different host.
139
+ * Treat every 2xx status (including 208 and 226) as success. Retryable HTTP
140
+ statuses are retried in the block/error-suppression path too, and the
141
+ circuit breaker judges the actual response even when the block returns a
142
+ different value; an unknown or absent response no longer counts as a
143
+ success.
144
+ * Token-provider refresh now applies to undeclared 401 responses and honors
145
+ `auth false`. Circuit-breaker transitions are posted outside the lock, so
146
+ subscribers can safely inspect the breaker.
147
+ * Redact URL passwords from notifications and `Request#inspect` as well as
148
+ logs, and use the documented `<<` interface when logging a failing
149
+ notification subscriber.
150
+ * Non-seekable payload streams are no longer consumed by request logging and
151
+ report as non-rewindable instead of raising `Errno::ESPIPE`;
152
+ `Payload.generate` no longer mutates the caller's `:multipart` flag.
153
+ * OpenAPI exclusive bounds shift by one only for integer schemas; number
154
+ schemas use an inclusive approximation with a note.
155
+ * Sequence fixtures treat false/nil payload values as present and anchor
156
+ stub paths so a prefix does not match a longer path.
157
+ * Live-network integration specs are tagged and excluded by default; run
158
+ them explicitly with `LIVE_HTTP_TESTS=1` or `rake spec:live`.
159
+ * Documentation now keeps module helpers header-only (resilience options go
160
+ through `Contractful::Request.execute`), aligns URL-credential redaction
161
+ guidance with the implementation, and removes stale version labels.
162
+
163
+ # 2.6.0
164
+
165
+ Roadmap-helpers release: the two planned development-time companions to
166
+ the contract-first layer (REQ-N01, REQ-N02), plus the documentation suite
167
+ and the review-hardening fixes that landed on master ahead of the release.
168
+
169
+ * Add the project documentation suite: `AGENTS.md`, `CONTRIBUTING.md`,
170
+ `PRD.md`, `DESIGN.md`, `ARCHITECTURE.md`, `API.md`, `DATABASE.md` at the
171
+ root, plus `docs/` with the requirements traceability matrix,
172
+ architecture decision records (0001–0003), implementation plan and setup
173
+ guide, engineering guides (testing, quality gates, error handling,
174
+ integrations), security documents (threat model, agent tool policy),
175
+ operations guides (delivery, observability, runbook) and the agent
176
+ workflow playbook.
177
+ * Fix the `spec:unit` rake task to use the `spec/unit/**/*_spec.rb` glob —
178
+ the previous pattern skipped the nested `spec/unit/contract/` directory,
179
+ so the contract-first suite never ran under CI's unit job.
180
+ * Add the OpenAPI import helper (REQ-N01): an opt-in, development-time
181
+ reader (`require 'contractful/contract/openapi_import'`) that converts an
182
+ OpenAPI 3.x document into `contract` definitions — typed closed-schema
183
+ params with enum/min/max/length/pattern constraints, `payload_style`
184
+ inference, response statuses (including `2XX` wildcards), JSON body
185
+ types and open-schema `response_field` bindings. A notes channel reports
186
+ every lossy mapping decision (header params, multipart bodies, `oneOf`
187
+ unions, `default` responses) instead of guessing, `to_ruby` renders a
188
+ ready-to-paste client class from the built definitions, and the
189
+ generated source round-trips through `Definition#describe`.
190
+ * Add the recorded-sequence test helper (REQ-N02): an opt-in, test-only
191
+ module (`require 'contractful/contract/sequence'`) that replays recorded
192
+ vendor response sequences through a contract client under WebMock. Each
193
+ fixture step stubs its recorded response, invokes the contract method
194
+ and runs the contract's own validation — the first violation fails with
195
+ the step number attached. `expect_request` assertions pin outgoing
196
+ paths, query params, headers and JSON payload subsets (unknown keys are
197
+ rejected at load time); `before_step`/`after_step` hooks carry the
198
+ stateful rules contracts cannot express (token refresh sequencing,
199
+ rate-limit windows, cross-step invariants).
200
+ Review-hardening fixes from a skills-based code review (secret redaction,
201
+ contract layer robustness, spec hygiene). No public API changes.
202
+
203
+ * Redact credential-bearing request headers from the request log. The
204
+ request log line (`Contractful.get "http://...", "Accept"=>...`) now
205
+ renders `Authorization`, `Proxy-Authorization` and `Cookie` values as
206
+ `[REDACTED]`, honoring the promise in
207
+ `docs/operations/OBSERVABILITY.md` ("auth headers are not logged") and
208
+ closing the T5 credential-leakage path in the threat model. Non-credential
209
+ headers are logged exactly as before.
210
+ * Use the redacted URL in raw-response streaming progress logs. The
211
+ `streaming GET ... % done` lines previously logged the raw URL, leaking
212
+ basic-auth credentials embedded in the URL; every other log line already
213
+ used the redacted form.
214
+ * Fix a `TypeError` ("no implicit conversion of nil into Hash") raised from
215
+ `__contract_effective_headers` when a contract client subclass defines
216
+ its own `initialize` without calling `super`.
217
+ * Bound the custom-class param coercion fallback to Kernel casts. The last
218
+ resort cast in `Contractful::Contract::Param` used to `send` a method
219
+ named after the type class on the param object itself (unbounded dynamic
220
+ dispatch); it now only attempts public `Kernel` module functions
221
+ (`Float`, `Complex`, ...).
222
+ * Harden `Payload::Multipart#boundary` against frozen `SecureRandom.base64`
223
+ return values: the `+`/`/` -> `A`/`B` substitution no longer mutates the
224
+ generated string in place, so the boundary can be built even when the
225
+ generated string is frozen.
226
+ * Enforce the repo hard rule "`frozen_string_literal: true` at the top of
227
+ every file under `lib/` and `spec/`" for the 19 spec files that were
228
+ still missing the magic comment, and adjust the few specs that mutated
229
+ frozen literals in place (`String#force_encoding` on literals now goes
230
+ through `.dup`).
231
+ * Remove an unused variable warning in the idempotency spec.
232
+ * Guard `Payload::Base#to_s` against non-seekable streams: the rewind after
233
+ reading used to raise `NoMethodError` (reader objects without `#seek`) or
234
+ `Errno::ESPIPE` (pipes, sockets), which crashed `Request#log_request` for
235
+ small streamed payloads; non-rewindable streams are now left positioned at
236
+ EOF, mirroring the defensive `Payload#rewind` contract.
237
+ * Resolve case-insensitive header collisions in `make_headers`: a user header
238
+ spelled `'content-type'` now replaces (instead of coexisting with) the
239
+ default `'Content-Type'`, so duplicate headers no longer reach the wire, and
240
+ the payload-override and Cookie-override warnings fire across casings.
241
+ String header keys still pass through verbatim (rest-client 1.x/2.x
242
+ compatibility, upstream issue #599); both behaviors are pinned by specs.
243
+ * Document the finalized design decisions from the repository review in
244
+ `docs/adr/0004-review-observations-resolution.md` (non-seekable payload
245
+ logging, string header passthrough, connection pool without a checkout cap,
246
+ and the frozen `Response < String` / response-block arity API), with an
247
+ API-freeze note at the response-block call site.
248
+ * Shrink the RuboCop baseline from 197 cops / 4,766 quarantined offenses to
249
+ 81 cops / ~2,100: all safe autocorrections applied (whitespace, literal
250
+ style, safe refactors) plus hand fixes for the non-correctable lint and
251
+ naming findings (constant renames `SSL_OPTION_LIST`/`WINDOWS_PLATFORMS`,
252
+ rescue-variable renames, real documentation comments for the previously
253
+ undocumented modules, duplicated-branch merge in the contract DSL). Four
254
+ intentional patterns moved out of the auto-generated todo into documented
255
+ `.rubocop.yml` entries (rescue ::Exception around pool invalidation, the
256
+ to_ruby eval sandbox, symbol numbering like `:TLSv1_2`, and the public
257
+ `has_file?`/`has_default?` predicate names). The stdout/stderr log devices
258
+ now write via `$stdout`/`warn` so logging follows a reassigned `$stdout`,
259
+ and the log specs assert captured output instead of spying on IO methods.
260
+
261
+ # 2.5.0
262
+
263
+ Feature release completing the contract-first layer: closed request
264
+ schemas, open response schemas, contract-declared auth, idempotency keys,
265
+ pagination and rate-limit awareness — the pieces a contract needs to carry
266
+ beyond shapes.
267
+
268
+ * Add closed-schema param constraints: `min:` / `max:` (inclusive bounds on
269
+ any Comparable), `length:` (exact Integer or Range over String/Array/Hash)
270
+ and `pattern:` (Regexp on Strings). Constraints are enforced after
271
+ coercion — `param :quantity, Integer, min: 1` rejects the string "0"
272
+ exactly like the integer 0 — and every violation raises `InvalidParam`
273
+ before any HTTP request is built.
274
+ * Add `response_field`: per-field response bindings with open-schema
275
+ semantics. Required fields and their types bind (missing, null or
276
+ type-mismatched fields raise `UnexpectedResponse` on return), while
277
+ undeclared fields are additive data and `inclusion:` sets are not
278
+ enforced unless `strict: true` — a new enum member the client does not
279
+ know about yet is data, not an error. Values are never coerced.
280
+ * Add contract-declared auth: `auth bearer:`, `auth api_key:` (single or
281
+ multiple entries, header or query location — the dual-header style) and
282
+ `auth basic:`. Credentials may be literals or callables; callables are
283
+ invoked per request so short-lived tokens stay fresh. Auth is resolved
284
+ before the `before_request` callbacks (which can still override it),
285
+ inherits down the class chain, and individual contracts can opt out with
286
+ `auth false`.
287
+ * Add retryable vs terminal error classification:
288
+ `Contractful::Exceptions::RETRIABLE_STATUSES` (408, 425, 429, 500, 502,
289
+ 503, 504), `Exception#retryable?` and `Exceptions.retryable?` (which also
290
+ classifies plain network errors like `SocketError`/`Errno::*`). Requests
291
+ now retry retryable HTTP statuses — not just network failures — when
292
+ `:max_retries` is positive, honoring the server's `Retry-After` header
293
+ (delta-seconds or HTTP-date, capped by the new `:max_retry_after`
294
+ option, default 60), including inside the block/error-suppression path.
295
+ Opt out with `retry_after: false`.
296
+ * Add idempotency keys: flag a contract `idempotent` and every call carries
297
+ an `Idempotency-Key` header (header name and generator configurable at
298
+ class level, per-call key via `_idempotency_key:`), generated once per
299
+ logical call and stable across automatic retries — which is what makes
300
+ retrying POSTs safe.
301
+ * Add pagination contracts: `paginated style: :cursor, cursor_param:,
302
+ next_cursor_path:, items_path:` or `style: :offset, offset_param:,
303
+ limit_param:, has_more_path:`. Every paginated contract gets two
304
+ metaprogrammed methods — `#{name}_pages` (lazy Enumerator of validated
305
+ page responses) and `all_#{name}` (flat collector). A `_max_pages` guard
306
+ (default 1000) raises `Contractful::Contract::PaginationError` instead of
307
+ looping forever, and page 1 can resume from an explicitly supplied
308
+ cursor or offset.
309
+ * Add rate-limit header parsing: `Contractful::RateLimit` reads the IETF
310
+ `RateLimit-*` headers and the legacy `X-RateLimit-*` convention
311
+ (preferring IETF), handling integer/HTTP-date/epoch resets and the
312
+ "limit, limit;w=window" description form. Every response exposes
313
+ `response.rate_limit` (nil when the server sends no headers — data
314
+ absence, not an error) and `response.rate_limited?` (429 or exhausted
315
+ quota). A 429 without `Retry-After` falls back to the `RateLimit-Reset`
316
+ window before exponential backoff.
317
+
318
+ # 2.4.0
319
+
320
+ Feature release adding a contract-first architecture layer with heavy
321
+ metaprogramming on top of the classic contractful API.
322
+
323
+ * Add `Contractful::Contract`: declare API operations as contracts —
324
+ `contract :name, 'VERB /path'` with an `instance_eval`'d DSL block — and
325
+ the gem generates the client methods (`define_method`), `#{name}_url`
326
+ path builders, parameter validation and a reflection API for you. The
327
+ contract *is* the implementation.
328
+ * Add a typed parameter engine: `String`, `Integer`, `Float`, `:boolean`,
329
+ `Array`, `Hash`, arbitrary classes (`is_a?` check, then
330
+ `Class#contractful_coerce`, then a Kernel cast) and `Proc` coercions, with
331
+ `required:`, `default:` (lazy procs supported), `inclusion:` and
332
+ `coerce: false` strict mode. Path placeholders (`:owner`, `:repo`) are
333
+ auto-synthesized as required params, URI-escaped and consumed out of the
334
+ query/payload. Violations raise `MissingParam`, `UnknownParam` or
335
+ `InvalidParam` with precise messages before any HTTP traffic happens.
336
+ * Add response contracts: `responds 200, 404, type: Hash` declares expected
337
+ statuses (Integers or Ranges) and an optional JSON body type
338
+ (`:array`/`:hash`/`:string`/`:json`/any class). Declaring 4xx/5xx statuses
339
+ suppresses the default exception behavior for that contract — expected
340
+ error responses become normal return values (redirects are still
341
+ followed). Violations raise `UnexpectedResponse` with the response
342
+ attached. `verify_response` blocks add custom assertions and receive the
343
+ JSON-parsed body when declared with two parameters.
344
+ * Add `before_request` / `after_response` callbacks: `before_request`
345
+ receives a mutable execution context (changing it changes the outgoing
346
+ request), `after_response` receives the validated response. Both
347
+ accumulate down the class inheritance chain, root-most first.
348
+ * Add the `resource :posts` macro: metaprograms the five standard REST
349
+ CRUD contracts (`list_posts`, `get_post`, `create_post`, `update_post`,
350
+ `delete_post`) with `only:`/`except:` filters, `update_with: :put`,
351
+ `path:` override and a small English singularizer (`singular:` override).
352
+ Generated CRUD contracts accept free-form attributes via the new
353
+ per-contract `strict_params` override.
354
+ * Add reflection and dynamic dispatch: `.contracts`, `.contract_names`,
355
+ `.contract?`, `.contract_for` (class and instance level,
356
+ inheritance-aware) plus `method_missing`-powered `call_#{name}`,
357
+ `#{name}_contract` and `has_#{name}?` with `respond_to_missing?` support.
358
+ * Add per-call meta options for contracts (`_headers`, `_timeout`,
359
+ `_open_timeout`, `_read_timeout`, `_write_timeout`, `_persistent`,
360
+ `_max_retries`, `_retry_interval`) and instance-level overrides via
361
+ `MyAPI.new(base:, headers:)`.
362
+
363
+ # 2.3.0
364
+
365
+ Feature release building on the 2.2.0 modernization.
366
+
367
+ * Add `Response#json`: parse the response body as JSON with a single call
368
+ (`response.json`, or `response.json(symbolize_names: true)`). Keyword
369
+ arguments are forwarded to `JSON.parse`.
370
+ * Add optional persistent connections (HTTP keep-alive): pass
371
+ `persistent: true` to reuse the underlying connection across requests via
372
+ the new thread-safe `Contractful::ConnectionPool` (also available as
373
+ `Contractful.connection_pool`). Connections are pooled per host/proxy/SSL
374
+ settings, never shared concurrently, discarded after network failures, and
375
+ re-established when the server closed them.
376
+ * Add automatic retries: pass `:max_retries` (plus the optional
377
+ `:retry_interval`, default 0.5s) to retry requests after transient network
378
+ failures — connection/read/write timeouts, broken connections, connection
379
+ resets and broken pipes — with exponential backoff. HTTP error responses are
380
+ never retried, and payloads are rewound between attempts (non-rewindable
381
+ payload streams disable retrying).
382
+ * Add `Contractful::Exceptions::WriteTimeout`, raised when `Net::WriteTimeout`
383
+ fires. Previously a write timeout leaked a raw `Net::WriteTimeout` (or was
384
+ misclassified as a read timeout), so the three timeout phases now share the
385
+ common `Contractful::Exceptions::Timeout` rescue target.
386
+
387
+ # 2.2.0
388
+
389
+ Modernization release, reviving the gem after the upstream repository was
390
+ archived in 2019. The public API is unchanged; this release is about modern
391
+ Ruby support, tooling, and a few new request options.
392
+
393
+ * Support and CI-test Ruby 3.0, 3.1, 3.2, 3.3, 3.4, 4.0 and ruby-head
394
+ (experimental). `required_ruby_version` is now `>= 3.0`.
395
+ * Add a `:write_timeout` request option, mapping to `Net::HTTP#write_timeout`,
396
+ to bound time spent sending request bodies.
397
+ * Add `:ssl_min_version` and `:ssl_max_version` request options, mapping to
398
+ `OpenSSL::SSL::SSLContext#min_version=` / `#max_version=`. This is the modern
399
+ way to constrain TLS protocol versions (for example `:ssl_min_version =>
400
+ :TLSv1_2`), complementing the legacy `:ssl_version` option.
401
+ * Reject URIs whose hostname is empty (Ruby 3.4+ returns `''` rather than `nil`
402
+ for URLs like `http:///`).
403
+ * Remove the legacy Ruby 2.0 code paths from `Contractful::Utils`
404
+ (`deprecated_cgi_parse_header` and friends); `HTTP::Accept` is now always
405
+ used for Content-Type parsing.
406
+ * Add `# frozen_string_literal: true` to all library files.
407
+ * Modernize the gemspec: remove the deprecated `test_files` field, add gem
408
+ metadata (`changelog_uri`, `bug_tracker_uri`, `rubygems_mfa_required`), point
409
+ the homepage at this maintained fork, and refresh development dependencies
410
+ (rspec ~> 3.13, webmock >= 3.19 < 5, pry ~> 0.14, rdoc >= 6.0). Drop the
411
+ stale rubocop 0.49 / pry-doc development dependencies; rubocop tooling can be
412
+ reintroduced later alongside a dedicated style pass.
413
+ * Fix the Windows gemspec to work when evaluated by modern Bundler, bump its
414
+ ffi dependency to `~> 1.16`, and add the modern `x64-mingw-ucrt` platform.
415
+ * Replace the dead Travis CI setup with a GitHub Actions workflow that runs the
416
+ unit and integration suites across the supported Ruby matrix.
417
+ * Update the integration test CA fixtures: www.mozilla.org now chains to Let's
418
+ Encrypt (ISRG Root X1) rather than DigiCert, so the bundled root certificate
419
+ and capath fixtures were replaced.
420
+ * Update specs for Ruby 3+ keyword-argument semantics (rspec-mocks now treats
421
+ bare `with(...)` hashes as keyword arguments) and for Ruby 4.0 removing the
422
+ `base64` gem from the default gems.
423
+ * The default `rake` task now runs the test suite.
424
+
425
+ # 2.1.0
426
+
427
+ - Add a dependency on http-accept for parsing Content-Type charset headers.
428
+ This works around a bad memory leak introduced in MRI Ruby 2.4.0 and fixed in
429
+ Ruby 2.4.2. (#615)
430
+ - Use mime/types/columnar from mime-types 2.6.1+, which is leaner in memory
431
+ usage than the older storage model of mime-types. (#393)
432
+ - Add `:log` option to individual requests. This allows users to set a log on a
433
+ per-request / per-resource basis instead of the kludgy global log. (#538)
434
+ - Log request duration by tracking request start and end times. Make
435
+ `log_response` a method on the Response object, and ensure the `size` method
436
+ works on RawResponse objects. (#126)
437
+ - `# => 200 OK | text/html 1270 bytes, 0.08s`
438
+ - Also add a new `:stream_log_percent` parameter, which is applicable only
439
+ when `:raw_response => true` is set. This causes progress logs to be
440
+ emitted only on every N% (default 10%) of the total download size rather
441
+ than on every chunk.
442
+ - Drop custom handling of compression and use built-in Net::HTTP support for
443
+ supported Content-Encodings like gzip and deflate. Don't set any explicit
444
+ `Accept-Encoding` header, rely instead on Net::HTTP defaults. (#597)
445
+ - Note: this changes behavior for compressed responses when using
446
+ `:raw_response => true`. Previously the raw response would not have been
447
+ uncompressed by contractful, but now Net::HTTP will uncompress it.
448
+ - The previous fix to avoid having Netrc username/password override an
449
+ Authorization header was case-sensitive and incomplete. Fix this by
450
+ respecting existing Authorization headers, regardless of letter case. (#550)
451
+ - Handle ParamsArray payloads. Previously, contractful would silently drop a
452
+ ParamsArray passed as the payload. Instead, automatically use
453
+ Payload::Multipart if the ParamsArray contains a file handle, or use
454
+ Payload::UrlEncoded if it doesn't. (#508)
455
+ - Gracefully handle Payload objects (Payload::Base or subclasses) that are
456
+ passed as a payload argument. Previously, `Payload.generate` would wrap a
457
+ Payload object in Payload::Streamed, creating a pointlessly nested payload.
458
+ Also add a `closed?` method to Payload objects, and don't error in
459
+ `short_inspect` if `size` returns nil. (#603)
460
+ - Test with an image in the public domain to avoid licensing complexity. (#607)
461
+
462
+ # 2.0.2
463
+
464
+ - Suppress the header override warning introduced in 2.0.1 if the value is the
465
+ same. There's no conflict if the value is unchanged. (#578)
466
+
467
+ # 2.0.1
468
+
469
+ - Warn if auto-generated headers from the payload, such as Content-Type,
470
+ override headers set by the user. This is usually not what the user wants to
471
+ happen, and can be surprising. (#554)
472
+ - Drop the old check for weak default TLS ciphers, and use the built-in Ruby
473
+ defaults. Ruby versions from Oct. 2014 onward use sane defaults, so this is
474
+ no longer needed. (#573)
475
+
476
+ # 2.0.0
477
+
478
+ This release is largely API compatible, but makes several breaking changes.
479
+
480
+ - Drop support for Ruby 1.9
481
+ - Allow mime-types as new as 3.x (requires ruby 2.0)
482
+ - Respect Content-Type charset header provided by server. Previously,
483
+ contractful would not override the string encoding chosen by Net::HTTP. Now
484
+ responses that specify a charset will yield a body string in that encoding.
485
+ For example, `Content-Type: text/plain; charset=EUC-JP` will return a String
486
+ encoded with `Encoding::EUC_JP`. (#361)
487
+ - Change exceptions raised on request timeout. Instead of
488
+ `Contractful::RequestTimeout` (which is still used for HTTP 408), network
489
+ timeouts will now raise either `Contractful::Exceptions::ReadTimeout` or
490
+ `Contractful::Exceptions::OpenTimeout`, both of which inherit from
491
+ `Contractful::Exceptions::Timeout`. For backwards compatibility, this still
492
+ inherits from `Contractful::RequestTimeout` so existing uses will still work.
493
+ This may change in a future major release. These new timeout classes also
494
+ make the original wrapped exception available as `#original_exception`.
495
+ - Unify request exceptions under `Contractful::RequestFailed`, which still
496
+ inherits from `ExceptionWithResponse`. Previously, HTTP 304, 401, and 404
497
+ inherited directly from `ExceptionWithResponse` rather than from
498
+ `RequestFailed`. Now _all_ HTTP status code exceptions inherit from both.
499
+ - Rename the `:timeout` request option to `:read_timeout`. When `:timeout` is
500
+ passed, now set both `:read_timeout` and `:open_timeout`.
501
+ - Change default HTTP Accept header to `*/*`
502
+ - Use a more descriptive User-Agent header by default
503
+ - Drop RC4-MD5 from default cipher list
504
+ - Only prepend http:// to URIs without a scheme
505
+ - Fix some support for using IPv6 addresses in URLs (still affected by Ruby
506
+ 2.0+ bug https://bugs.ruby-lang.org/issues/9129, with the fix expected to be
507
+ backported to 2.0 and 2.1)
508
+ - `Response` objects are now a subclass of `String` rather than a `String` that
509
+ mixes in the response functionality. Most of the methods remain unchanged,
510
+ but this makes it much easier to understand what is happening when you look
511
+ at a Contractful response object. There are a few additional changes:
512
+ - Response objects now implement `.inspect` to make this distinction clearer.
513
+ - `Response#to_i` will now behave like `String#to_i` instead of returning the
514
+ HTTP response code, which was very surprising behavior.
515
+ - `Response#body` and `#to_s` will now return a true `String` object rather
516
+ than self. Previously there was no easy way to get the true `String`
517
+ response instead of the Frankenstein response string object with
518
+ AbstractResponse mixed in.
519
+ - Response objects no longer accept an extra request args hash, but instead
520
+ access request args directly from the request object, which reduces
521
+ confusion and duplication.
522
+ - Handle multiple HTTP response headers with the same name (except for
523
+ Set-Cookie, which is special) by joining the values with a comma space,
524
+ compliant with RFC 7230
525
+ - Rewrite cookie support to be much smarter and to use cookie jars consistently
526
+ for requests, responses, and redirection in order to resolve long-standing
527
+ complaints about the previously broken behavior: (#498)
528
+ - The `:cookies` option may now be a Hash of Strings, an Array of
529
+ HTTP::Cookie objects, or a full HTTP::CookieJar.
530
+ - Add `Contractful::Request#cookie_jar` and reimplement `Request#cookies` to
531
+ be a wrapper around the cookie jar.
532
+ - Still support passing the `:cookies` option in the headers hash, but now
533
+ raise ArgumentError if that option is also passed to `Request#initialize`.
534
+ - Warn if both `:cookies` and a `Cookie` header are supplied.
535
+ - Use the `Request#cookie_jar` as the basis for `Response#cookie_jar`,
536
+ creating a copy of the jar and adding any newly received cookies.
537
+ - When following redirection, also use this same strategy so that cookies
538
+ from the original request are carried through in a standards-compliant way
539
+ by the cookie jar.
540
+ - Don't set basic auth header if explicit `Authorization` header is specified
541
+ - Add `:proxy` option to requests, which can be used for thread-safe
542
+ per-request proxy configuration, overriding `Contractful.proxy`
543
+ - Allow overriding `ENV['http_proxy']` to disable proxies by setting
544
+ `Contractful.proxy` to a falsey value. Previously there was no way in Ruby 2.x
545
+ to turn off a proxy specified in the environment without changing `ENV`.
546
+ - Add actual support for streaming request payloads. Previously contractful
547
+ would call `.to_s` even on Contractful::Payload::Streamed objects. Instead,
548
+ treat any object that responds to `.read` as a streaming payload and pass it
549
+ through to `.body_stream=` on the Net:HTTP object. This massively reduces the
550
+ memory required for large file uploads.
551
+ - Changes to redirection behavior: (#381, #484)
552
+ - Remove `Contractful::MaxRedirectsReached` in favor of the normal
553
+ `ExceptionWithResponse` subclasses. This makes the response accessible on
554
+ the exception object as `.response`, making it possible for callers to tell
555
+ what has actually happened when the redirect limit is reached.
556
+ - When following HTTP redirection, store a list of each previous response on
557
+ the response object as `.history`. This makes it possible to access the
558
+ original response headers and body before the redirection was followed.
559
+ - Follow redirection consistently, regardless of whether the HTTP method was
560
+ passed as a symbol or string. Under the hood contractful now normalizes the
561
+ HTTP request method to a lowercase string.
562
+ - Add `:before_execution_proc` option to `Contractful::Request`. This makes it
563
+ possible to add procs like `Contractful.add_before_execution_proc` to a single
564
+ request without global state.
565
+ - Run tests on Travis's beta OS X support.
566
+ - Make `Request#transmit` a private method, along with a few others.
567
+ - Refactor URI parsing to happen earlier, in Request initialization.
568
+ - Improve consistency and functionality of complex URL parameter handling:
569
+ - When adding URL params, handle URLs that already contain params.
570
+ - Add new convention for handling URL params containing deeply nested arrays
571
+ and hashes, unify handling of null/empty values, and use the same code for
572
+ GET and POST params. (#437)
573
+ - Add the Contractful::ParamsArray class, a simple array-like container that
574
+ can be used to pass multiple keys with same name or keys where the ordering
575
+ is significant.
576
+ - Add a few more exception classes for obscure HTTP status codes.
577
+ - Multipart: use a much more robust multipart boundary with greater entropy.
578
+ - Make `Contractful::Payload::Base#inspect` stop pretending to be a String.
579
+ - Add `Request#redacted_uri` and `Request#redacted_url` to display the URI
580
+ with any password redacted.
581
+
582
+ # 2.0.0.rc1
583
+
584
+ Changes in the release candidate that did not persist through the final 2.0.0
585
+ release:
586
+ - Contractful::Exceptions::Timeout was originally going to be a direct subclass
587
+ of Contractful::Exception in the release candidate. This exception tree was
588
+ made a subclass of Contractful::RequestTimeout prior to the final release.
589
+
590
+ # 1.8.0
591
+
592
+ - Security: implement standards compliant cookie handling by adding a
593
+ dependency on http-cookie. This breaks compatibility, but was necessary to
594
+ address a session fixation / cookie disclosure vulnerability.
595
+ (#369 / CVE-2015-1820)
596
+
597
+ Previously, any Set-Cookie headers found in an HTTP 30x response would be
598
+ sent to the redirection target, regardless of domain. Responses now expose a
599
+ cookie jar and respect standards compliant domain / path flags in Set-Cookie
600
+ headers.
601
+
602
+ # 1.7.3
603
+
604
+ - Security: redact password in URI from logs (#349 / OSVDB-117461)
605
+ - Drop monkey patch on MIME::Types (added `type_for_extension` method, use
606
+ the public interface instead.
607
+
608
+ # 1.7.2
609
+
610
+ - Ignore duplicate certificates in CA store on Windows
611
+
612
+ # 1.7.1
613
+
614
+ - Relax mime-types dependency to continue supporting mime-types 1.x series.
615
+ There seem to be a large number of popular gems that have depended on
616
+ mime-types '~> 1.16' until very recently.
617
+ - Improve urlencode performance
618
+ - Clean up a number of style points
619
+
620
+ # 1.7.0
621
+
622
+ - This release drops support for Ruby 1.8.7 and breaks compatibility in a few
623
+ other relatively minor ways
624
+ - Upgrade to mime-types ~> 2.0
625
+ - Don't CGI.unescape cookie values sent to the server (issue #89)
626
+ - Add support for reading credentials from netrc
627
+ - Lots of SSL changes and enhancements: (#268)
628
+ - Enable peer verification by default (setting `VERIFY_PEER` with OpenSSL)
629
+ - By default, use the system default certificate store for SSL verification,
630
+ even on Windows (this uses a separate Windows build that pulls in ffi)
631
+ - Add support for SSL `ca_path`
632
+ - Add support for SSL `cert_store`
633
+ - Add support for SSL `verify_callback` (with some caveats for jruby, OS X, #277)
634
+ - Add support for SSL ciphers, and choose secure ones by default
635
+ - Run tests under travis
636
+ - Several other bugfixes and test improvements
637
+ - Convert Errno::ETIMEDOUT to Contractful::RequestTimeout
638
+ - Handle more HTTP response codes from recent standards
639
+ - Save raw responses to binary mode tempfile (#110)
640
+ - Disable timeouts with :timeout => nil rather than :timeout => -1
641
+ - Drop all Net::HTTP monkey patches
642
+
643
+ # 1.6.14
644
+
645
+ - This release is unchanged from 1.6.9. It was published in order to supersede
646
+ the malicious 1.6.10-13 versions, even for users who are still pinning to the
647
+ legacy 1.6.x series. All users are encouraged to upgrade to rest-client 2.x.
648
+
649
+ # 1.6.10, 1.6.11, 1.6.12, 1.6.13 (CVE-2019-15224)
650
+
651
+ - These versions were pushed by a malicious actor and included a backdoor permitting
652
+ remote code execution in Rails environments. (#713)
653
+ - They were live for about five days before being yanked.
654
+
655
+ # 1.6.9
656
+
657
+ - Move rdoc to a development dependency
658
+
659
+ # 1.6.8
660
+
661
+ - The 1.6.x series will be the last to support Ruby 1.8.7
662
+ - Pin mime-types to < 2.0 to maintain Ruby 1.8.7 support
663
+ - Add Gemfile, AUTHORS, add license to gemspec
664
+ - Point homepage at https://github.com/rest-client/rest-client
665
+ - Clean up and fix various tests and ruby warnings
666
+ - Backport `ssl_verify_callback` functionality from 1.7.0
667
+
668
+ # 1.6.7
669
+
670
+ - rebuild with 1.8.7 to avoid https://github.com/rubygems/rubygems/pull/57
671
+
672
+ # 1.6.6
673
+
674
+ - 1.6.5 was yanked
675
+
676
+ # 1.6.5
677
+
678
+ - RFC6265 requires single SP after ';' for separating parameters pairs in the 'Cookie:' header (patch provided by Hiroshi Nakamura)
679
+ - enable url parameters for all actions
680
+ - detect file parameters in arrays
681
+ - allow disabling the timeouts by passing -1 (patch provided by Sven Böhm)
682
+
683
+ # 1.6.4
684
+
685
+ - fix contractful script compatibility with 1.9.2
686
+ - fix unlinking temp file (patch provided by Evan Smith)
687
+ - monkeypatching ruby for http patch method (patch provided by Syl Turner)
688
+
689
+ # 1.6.3
690
+
691
+ - 1.6.2 was yanked
692
+
693
+ # 1.6.2
694
+
695
+ - add support for HEAD in resources (patch provided by tpresa)
696
+ - fix shell for 1.9.2
697
+ - workaround when some gem monkeypatch net/http (patch provided by Ian Warshak)
698
+ - DELETE requests should process parameters just like GET and HEAD
699
+ - adding :block_response parameter for manual processing
700
+ - limit number of redirections (patch provided by Chris Dinn)
701
+ - close and unlink the temp file created by playload (patch provided by Chris Green)
702
+ - make gemspec Rubygems 1.8 compatible (patch provided by David Backeus)
703
+ - added Contractful.reset_before_execution_procs (patch provided by Cloudify)
704
+ - added PATCH method (patch provided by Jeff Remer)
705
+ - hack for HTTP servers that use raw DEFLATE compression, see http://www.ruby-forum.com/topic/136825 (path provided by James Reeves)
706
+
707
+ # 1.6.1
708
+
709
+ - add response body in Exception#inspect
710
+ - add support for Contractful.options
711
+ - fix tests for 1.9.2 (patch provided by Niko Dittmann)
712
+ - block passing in Resource#[] (patch provided by Niko Dittmann)
713
+ - cookies set in a response should be kept in a redirect
714
+ - HEAD requests should process parameters just like GET (patch provided by Rob Eanes)
715
+ - exception message should never be nil (patch provided by Michael Klett)
716
+
717
+ # 1.6.0
718
+
719
+ - forgot to include contractful.rb in the gem
720
+ - user, password and user-defined headers should survive a redirect
721
+ - added all missing status codes
722
+ - added parameter passing for get request using the :param key in header
723
+ - the warning about the logger when using a string was a bad idea
724
+ - multipart parameters names should not be escaped
725
+ - remove the cookie escaping introduced by migrating to CGI cookie parsing in 1.5.1
726
+ - add a streamed payload type (patch provided by Caleb Land)
727
+ - Exception#http_body works even when no response
728
+
729
+ # 1.5.1
730
+
731
+ - only converts headers keys which are Symbols
732
+ - use CGI for cookie parsing instead of custom code
733
+ - unescape user and password before using them (patch provided by Lars Gierth)
734
+ - expand ~ in ~/.contractfulrc (patch provided by Mike Fletcher)
735
+ - ssl verification raise an exception when the ca certificate is incorrect (patch provided by Braintree)
736
+
737
+ # 1.5.0
738
+
739
+ - the response is now a String with the Response module a.k.a. the change in 1.4.0 was a mistake (Response.body is returning self for compatability)
740
+ - added AbstractResponse.to_i to improve semantic
741
+ - multipart Payloads ignores the name attribute if it's not set (patch provided by Tekin Suleyman)
742
+ - correctly takes into account user headers whose keys are strings (path provided by Cyril Rohr)
743
+ - use binary mode for payload temp file
744
+ - concatenate cookies with ';'
745
+ - fixed deeper parameter handling
746
+ - do not quote the boundary in the Content-Type header (patch provided by W. Andrew Loe III)
747
+
748
+ # 1.4.2
749
+
750
+ - fixed Contractful.add_before_execution_proc (patch provided by Nicholas Wieland)
751
+ - fixed error when an exception is raised without a response (patch provided by Caleb Land)
752
+
753
+ # 1.4.1
754
+
755
+ - fixed parameters managment when using hash
756
+
757
+ # 1.4.0
758
+
759
+ - Response is no more a String, and the mixin is replaced by an abstract_response, existing calls are redirected to response body with a warning.
760
+ - enable repeated parameters Contractful.post 'http://example.com/resource', :param1 => ['one', 'two', 'three'], => :param2 => 'foo' (patch provided by Rodrigo Panachi)
761
+ - fixed the redirect code concerning relative path and query string combination (patch provided by Kevin Read)
762
+ - redirection code moved to Response so redirection can be customized using the block syntax
763
+ - only get and head redirections are now followed by default, as stated in the specification
764
+ - added Contractful.add_before_execution_proc to hack the http request, like for oauth
765
+
766
+ The response change may be breaking in rare cases.
767
+
768
+ # 1.3.1
769
+
770
+ - added compatibility to enable responses in exception to act like Net::HTTPResponse
771
+
772
+ # 1.3.0
773
+
774
+ - a block can be used to process a request's result, this enable to handle custom error codes or paththrought (design by Cyril Rohr)
775
+ - cleaner log API, add a warning for some cases but should be compatible
776
+ - accept multiple "Set-Cookie" headers, see http://www.ietf.org/rfc/rfc2109.txt (patch provided by Cyril Rohr)
777
+ - remove "Content-Length" and "Content-Type" headers when following a redirection (patch provided by haarts)
778
+ - all http error codes have now a corresponding exception class and all of them contain the Reponse -> this means that the raised exception can be different
779
+ - changed "Content-Disposition: multipart/form-data" to "Content-Disposition: form-data" per RFC 2388 (patch provided by Kyle Crawford)
780
+
781
+ The only breaking change should be the exception classes, but as the new classes inherits from the existing ones, the breaking cases should be rare.
782
+
783
+ # 1.2.0
784
+
785
+ - formatting changed from tabs to spaces
786
+ - logged requests now include generated headers
787
+ - accept and content-type headers can now be specified using extentions: Contractful.post "http://example.com/resource", { 'x' => 1 }.to_json, :content_type => :json, :accept => :json
788
+ - should be 1.1.1 but renamed to 1.2.0 because 1.1.X versions has already been packaged on Debian
789
+
790
+ # 1.1.0
791
+
792
+ - new maintainer: Archiloque, the working repo is now at http://github.com/archiloque/contractful
793
+ - a mailing list has been created at rest.client@librelist.com and an freenode irc channel #rest-client
794
+ - François Beausoleil' multipart code from http://github.com/francois/contractful has been merged
795
+ - ability to use hash in hash as payload
796
+ - the mime-type code now rely on the mime-types gem http://mime-types.rubyforge.org/ instead of an internal partial list
797
+ - 204 response returns a Response instead of nil (patch provided by Elliott Draper)
798
+
799
+ All changes exept the last one should be fully compatible with the previous version.
800
+
801
+ NOTE: due to a dependency problem and to the last change, heroku users should update their heroku gem to >= 1.5.3 to be able to use this version.