~ballot/wordpress/openstack-objectstorage

« back to all changes in this revision

Viewing changes to vendor/guzzlehttp/guzzle/UPGRADING.md

  • Committer: Benjamin Allot
  • Date: 2020-07-02 16:31:38 UTC
  • Revision ID: benjamin.allot@canonical.com-20200702163138-qyk6njanak5uw2pg
Revert to revno 3

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
Guzzle Upgrade Guide
2
2
====================
3
3
 
4
 
4.x to 5.0
5
 
----------
6
 
 
7
 
## Rewritten Adapter Layer
8
 
 
9
 
Guzzle now uses [RingPHP](http://ringphp.readthedocs.org/en/latest) to send
10
 
HTTP requests. The `adapter` option in a `GuzzleHttp\Client` constructor
11
 
is still supported, but it has now been renamed to `handler`. Instead of
12
 
passing a `GuzzleHttp\Adapter\AdapterInterface`, you must now pass a PHP
13
 
`callable` that follows the RingPHP specification.
14
 
 
15
 
## Removed Fluent Interfaces
16
 
 
17
 
[Fluent interfaces were removed](http://ocramius.github.io/blog/fluent-interfaces-are-evil)
18
 
from the following classes:
19
 
 
20
 
- `GuzzleHttp\Collection`
21
 
- `GuzzleHttp\Url`
22
 
- `GuzzleHttp\Query`
23
 
- `GuzzleHttp\Post\PostBody`
24
 
- `GuzzleHttp\Cookie\SetCookie`
25
 
 
26
 
## Removed functions.php
27
 
 
28
 
Removed "functions.php", so that Guzzle is truly PSR-4 compliant. The following
29
 
functions can be used as replacements.
30
 
 
31
 
- `GuzzleHttp\json_decode` -> `GuzzleHttp\Utils::jsonDecode`
32
 
- `GuzzleHttp\get_path` -> `GuzzleHttp\Utils::getPath`
33
 
- `GuzzleHttp\Utils::setPath` -> `GuzzleHttp\set_path`
34
 
- `GuzzleHttp\Pool::batch` -> `GuzzleHttp\batch`. This function is, however,
35
 
  deprecated in favor of using `GuzzleHttp\Pool::batch()`.
36
 
 
37
 
The "procedural" global client has been removed with no replacement (e.g.,
38
 
`GuzzleHttp\get()`, `GuzzleHttp\post()`, etc.). Use a `GuzzleHttp\Client`
39
 
object as a replacement.
40
 
 
41
 
## `throwImmediately` has been removed
42
 
 
43
 
The concept of "throwImmediately" has been removed from exceptions and error
44
 
events. This control mechanism was used to stop a transfer of concurrent
45
 
requests from completing. This can now be handled by throwing the exception or
46
 
by cancelling a pool of requests or each outstanding future request
47
 
individually.
48
 
 
49
 
## headers event has been removed
50
 
 
51
 
Removed the "headers" event. This event was only useful for changing the
52
 
body a response once the headers of the response were known. You can implement
53
 
a similar behavior in a number of ways. One example might be to use a
54
 
FnStream that has access to the transaction being sent. For example, when the
55
 
first byte is written, you could check if the response headers match your
56
 
expectations, and if so, change the actual stream body that is being
57
 
written to.
58
 
 
59
 
## Updates to HTTP Messages
60
 
 
61
 
Removed the `asArray` parameter from
62
 
`GuzzleHttp\Message\MessageInterface::getHeader`. If you want to get a header
63
 
value as an array, then use the newly added `getHeaderAsArray()` method of
64
 
`MessageInterface`. This change makes the Guzzle interfaces compatible with
65
 
the PSR-7 interfaces.
66
 
 
67
4
3.x to 4.0
68
5
----------
69
6
 
348
285
methods and a way in which to modify the transaction at that specific point in
349
286
time (e.g., intercept the request and set a response on the transaction).
350
287
 
351
 
- `request.before_send` has been renamed to `before` and now emits a
 
288
- `request.before_send` has been renamed to ``before`` and now emits a
352
289
  `GuzzleHttp\Event\BeforeEvent`
353
290
- `request.complete` has been renamed to `complete` and now emits a
354
291
  `GuzzleHttp\Event\CompleteEvent`.
503
440
## Metadata streams
504
441
 
505
442
`GuzzleHttp\Stream\MetadataStreamInterface` has been added to denote streams
506
 
that contain additional metadata accessible via `getMetadata()`.
 
443
that contain additonal metadata accessible via `getMetadata()`.
507
444
`GuzzleHttp\Stream\StreamInterface::getMetadata` and
508
445
`GuzzleHttp\Stream\StreamInterface::setMetadata` have been removed.
509
446