~ballot/wordpress/openstack-objectstorage

« back to all changes in this revision

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

  • Committer: Thomas Cuthbert
  • Date: 2020-04-23 05:22:45 UTC
  • Revision ID: thomas.cuthbert@canonical.com-20200423052245-1jxao3mw31w435js
[,r=trivial] bionic composer vendor update

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
 
4
67
3.x to 4.0
5
68
----------
6
69
 
285
348
methods and a way in which to modify the transaction at that specific point in
286
349
time (e.g., intercept the request and set a response on the transaction).
287
350
 
288
 
- `request.before_send` has been renamed to ``before`` and now emits a
 
351
- `request.before_send` has been renamed to `before` and now emits a
289
352
  `GuzzleHttp\Event\BeforeEvent`
290
353
- `request.complete` has been renamed to `complete` and now emits a
291
354
  `GuzzleHttp\Event\CompleteEvent`.
440
503
## Metadata streams
441
504
 
442
505
`GuzzleHttp\Stream\MetadataStreamInterface` has been added to denote streams
443
 
that contain additonal metadata accessible via `getMetadata()`.
 
506
that contain additional metadata accessible via `getMetadata()`.
444
507
`GuzzleHttp\Stream\StreamInterface::getMetadata` and
445
508
`GuzzleHttp\Stream\StreamInterface::setMetadata` have been removed.
446
509