Commit 116b4f7c authored by alexpott's avatar alexpott

Issue #2276119 by damiankloip: Upgrade Guzzle to version 4.1.0.

parent c8faf220
{ {
"_readme": [ "_readme": [
"This file locks the dependencies of your project to a known state", "This file locks the dependencies of your project to a known state",
"Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file" "Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically"
], ],
"hash": "cc429f39777a4435a2d1415648978f97", "hash": "15b33bcba2392fb947bc320f35fcc14e",
"packages": [ "packages": [
{ {
"name": "doctrine/annotations", "name": "doctrine/annotations",
...@@ -458,26 +459,30 @@ ...@@ -458,26 +459,30 @@
}, },
{ {
"name": "guzzlehttp/guzzle", "name": "guzzlehttp/guzzle",
"version": "4.0.0", "version": "4.1.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/guzzle/guzzle.git", "url": "https://github.com/guzzle/guzzle.git",
"reference": "4063f08ca434efac12bf7a3db0d370b1c451345b" "reference": "85a0ba7de064493c928a8bcdc5eef01e0bde9953"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/guzzle/guzzle/zipball/4063f08ca434efac12bf7a3db0d370b1c451345b", "url": "https://api.github.com/repos/guzzle/guzzle/zipball/85a0ba7de064493c928a8bcdc5eef01e0bde9953",
"reference": "4063f08ca434efac12bf7a3db0d370b1c451345b", "reference": "85a0ba7de064493c928a8bcdc5eef01e0bde9953",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"guzzlehttp/streams": "1.*", "ext-json": "*",
"guzzlehttp/streams": "~1.0",
"php": ">=5.4.0" "php": ">=5.4.0"
}, },
"require-dev": { "require-dev": {
"ext-curl": "*", "ext-curl": "*",
"phpunit/phpunit": "4.*", "phpunit/phpunit": "~4.0",
"psr/log": "~1" "psr/log": "~1.0"
},
"suggest": {
"ext-curl": "Guzzle will use specific adapters if cURL is present"
}, },
"type": "library", "type": "library",
"extra": { "extra": {
...@@ -515,7 +520,7 @@ ...@@ -515,7 +520,7 @@
"rest", "rest",
"web service" "web service"
], ],
"time": "2014-03-29 23:11:36" "time": "2014-05-28 05:13:19"
}, },
{ {
"name": "guzzlehttp/streams", "name": "guzzlehttp/streams",
...@@ -2098,12 +2103,8 @@ ...@@ -2098,12 +2103,8 @@
"time": "2013-06-12 19:46:58" "time": "2013-06-12 19:46:58"
} }
], ],
"packages-dev": [ "packages-dev": [],
"aliases": [],
],
"aliases": [
],
"minimum-stability": "stable", "minimum-stability": "stable",
"stability-flags": { "stability-flags": {
"symfony/yaml": 20, "symfony/yaml": 20,
...@@ -2115,7 +2116,5 @@ ...@@ -2115,7 +2116,5 @@
"platform": { "platform": {
"php": ">=5.4.2" "php": ">=5.4.2"
}, },
"platform-dev": [ "platform-dev": []
]
} }
...@@ -266,7 +266,7 @@ public function unregister() ...@@ -266,7 +266,7 @@ public function unregister()
public function loadClass($class) public function loadClass($class)
{ {
if ($file = $this->findFile($class)) { if ($file = $this->findFile($class)) {
include $file; includeFile($file);
return true; return true;
} }
...@@ -291,8 +291,25 @@ public function findFile($class) ...@@ -291,8 +291,25 @@ public function findFile($class)
return $this->classMap[$class]; return $this->classMap[$class];
} }
$file = $this->findFileWithExtension($class, '.php');
// Search for Hack files if we are running on HHVM
if ($file === null && defined('HHVM_VERSION')) {
$file = $this->findFileWithExtension($class, '.hh');
}
if ($file === null) {
// Remember that this class does not exist.
return $this->classMap[$class] = false;
}
return $file;
}
private function findFileWithExtension($class, $ext)
{
// PSR-4 lookup // PSR-4 lookup
$logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . '.php'; $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext;
$first = $class[0]; $first = $class[0];
if (isset($this->prefixLengthsPsr4[$first])) { if (isset($this->prefixLengthsPsr4[$first])) {
...@@ -321,7 +338,7 @@ public function findFile($class) ...@@ -321,7 +338,7 @@ public function findFile($class)
. strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR); . strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR);
} else { } else {
// PEAR-like class name // PEAR-like class name
$logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . '.php'; $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext;
} }
if (isset($this->prefixesPsr0[$first])) { if (isset($this->prefixesPsr0[$first])) {
...@@ -347,8 +364,15 @@ public function findFile($class) ...@@ -347,8 +364,15 @@ public function findFile($class)
if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) { if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) {
return $file; return $file;
} }
// Remember that this class does not exist.
return $this->classMap[$class] = false;
} }
} }
/**
* Scope isolated include.
*
* Prevents access to $this/self from included files.
*/
function includeFile($file)
{
include $file;
}
...@@ -6,8 +6,8 @@ ...@@ -6,8 +6,8 @@
$baseDir = dirname(dirname($vendorDir)); $baseDir = dirname(dirname($vendorDir));
return array( return array(
$vendorDir . '/kriswallsmith/assetic/src/functions.php',
$vendorDir . '/guzzlehttp/streams/src/functions.php', $vendorDir . '/guzzlehttp/streams/src/functions.php',
$vendorDir . '/kriswallsmith/assetic/src/functions.php',
$vendorDir . '/guzzlehttp/guzzle/src/functions.php', $vendorDir . '/guzzlehttp/guzzle/src/functions.php',
$baseDir . '/core/lib/Drupal.php', $baseDir . '/core/lib/Drupal.php',
); );
...@@ -49,9 +49,14 @@ public static function getLoader() ...@@ -49,9 +49,14 @@ public static function getLoader()
$includeFiles = require __DIR__ . '/autoload_files.php'; $includeFiles = require __DIR__ . '/autoload_files.php';
foreach ($includeFiles as $file) { foreach ($includeFiles as $file) {
require $file; composerRequireDrupal8($file);
} }
return $loader; return $loader;
} }
} }
function composerRequireDrupal8($file)
{
require $file;
}
...@@ -2049,69 +2049,6 @@ ...@@ -2049,69 +2049,6 @@
"stream" "stream"
] ]
}, },
{
"name": "guzzlehttp/guzzle",
"version": "4.0.0",
"version_normalized": "4.0.0.0",
"source": {
"type": "git",
"url": "https://github.com/guzzle/guzzle.git",
"reference": "4063f08ca434efac12bf7a3db0d370b1c451345b"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/guzzle/guzzle/zipball/4063f08ca434efac12bf7a3db0d370b1c451345b",
"reference": "4063f08ca434efac12bf7a3db0d370b1c451345b",
"shasum": ""
},
"require": {
"guzzlehttp/streams": "1.*",
"php": ">=5.4.0"
},
"require-dev": {
"ext-curl": "*",
"phpunit/phpunit": "4.*",
"psr/log": "~1"
},
"time": "2014-03-29 23:11:36",
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "4.0.x-dev"
}
},
"installation-source": "dist",
"autoload": {
"psr-4": {
"GuzzleHttp\\": "src/"
},
"files": [
"src/functions.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Michael Dowling",
"email": "mtdowling@gmail.com",
"homepage": "https://github.com/mtdowling"
}
],
"description": "Guzzle is a PHP HTTP client library and framework for building RESTful web service clients",
"homepage": "http://guzzlephp.org/",
"keywords": [
"client",
"curl",
"framework",
"http",
"http client",
"rest",
"web service"
]
},
{ {
"name": "symfony/css-selector", "name": "symfony/css-selector",
"version": "v2.4.4", "version": "v2.4.4",
...@@ -2166,5 +2103,72 @@ ...@@ -2166,5 +2103,72 @@
], ],
"description": "Symfony CssSelector Component", "description": "Symfony CssSelector Component",
"homepage": "http://symfony.com" "homepage": "http://symfony.com"
},
{
"name": "guzzlehttp/guzzle",
"version": "4.1.0",
"version_normalized": "4.1.0.0",
"source": {
"type": "git",
"url": "https://github.com/guzzle/guzzle.git",
"reference": "85a0ba7de064493c928a8bcdc5eef01e0bde9953"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/guzzle/guzzle/zipball/85a0ba7de064493c928a8bcdc5eef01e0bde9953",
"reference": "85a0ba7de064493c928a8bcdc5eef01e0bde9953",
"shasum": ""
},
"require": {
"ext-json": "*",
"guzzlehttp/streams": "~1.0",
"php": ">=5.4.0"
},
"require-dev": {
"ext-curl": "*",
"phpunit/phpunit": "~4.0",
"psr/log": "~1.0"
},
"suggest": {
"ext-curl": "Guzzle will use specific adapters if cURL is present"
},
"time": "2014-05-28 05:13:19",
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "4.0.x-dev"
}
},
"installation-source": "dist",
"autoload": {
"psr-4": {
"GuzzleHttp\\": "src/"
},
"files": [
"src/functions.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Michael Dowling",
"email": "mtdowling@gmail.com",
"homepage": "https://github.com/mtdowling"
}
],
"description": "Guzzle is a PHP HTTP client library and framework for building RESTful web service clients",
"homepage": "http://guzzlephp.org/",
"keywords": [
"client",
"curl",
"framework",
"http",
"http client",
"rest",
"web service"
]
} }
] ]
CHANGELOG CHANGELOG
========= =========
4.1.0 (2014-05-27)
------------------
* Added a `json` request option to easily serialize JSON payloads.
* Added a `GuzzleHttp\json_decode()` wrapper to safely parse JSON.
* Added `setPort()` and `getPort()` to `GuzzleHttp\Message\RequestInterface`.
* Added the ability to provide an emitter to a client in the client constructor.
* Added the ability to persist a cookie session using $_SESSION.
* Added a trait that can be used to add event listeners to an iterator.
* Removed request method constants from RequestInterface.
* Fixed warning when invalid request start-lines are received.
* Updated MessageFactory to work with custom request option methods.
* Updated cacert bundle to latest build.
4.0.2 (2014-04-16)
------------------
* Proxy requests using the StreamAdapter now properly use request_fulluri (#632)
* Added the ability to set scalars as POST fields (#628)
4.0.1 (2014-04-04)
------------------
* The HTTP status code of a response is now set as the exception code of
RequestException objects.
* 303 redirects will now correctly switch from POST to GET requests.
* The default parallel adapter of a client now correctly uses the MultiAdapter.
* HasDataTrait now initializes the internal data array as an empty array so
that the toArray() method always returns an array.
4.0.0 (2014-03-29) 4.0.0 (2014-03-29)
------------------ ------------------
...@@ -18,7 +48,7 @@ CHANGELOG ...@@ -18,7 +48,7 @@ CHANGELOG
----------------------- -----------------------
* Removed `getConfig()` and `setConfig()` from clients to avoid confusion * Removed `getConfig()` and `setConfig()` from clients to avoid confusion
around whether things like base_url, message_factory, etc should be able to around whether things like base_url, message_factory, etc. should be able to
be retrieved or modified. be retrieved or modified.
* Added `getDefaultOption()` and `setDefaultOption()` to ClientInterface * Added `getDefaultOption()` and `setDefaultOption()` to ClientInterface
* functions.php functions were renamed using snake_case to match PHP idioms * functions.php functions were renamed using snake_case to match PHP idioms
...@@ -150,11 +180,11 @@ CHANGELOG ...@@ -150,11 +180,11 @@ CHANGELOG
* See UPGRADING.md for more information on how to upgrade. * See UPGRADING.md for more information on how to upgrade.
* Requests now support the ability to specify an array of $options when creating a request to more easily modify a * Requests now support the ability to specify an array of $options when creating a request to more easily modify a
request. You can pass a 'request.options' configuration setting to a client to apply default request options to request. You can pass a 'request.options' configuration setting to a client to apply default request options to
every request created by a client (e.g. default query string variables, headers, curl options, etc). every request created by a client (e.g. default query string variables, headers, curl options, etc.).
* Added a static facade class that allows you to use Guzzle with static methods and mount the class to `\Guzzle`. * Added a static facade class that allows you to use Guzzle with static methods and mount the class to `\Guzzle`.
See `Guzzle\Http\StaticClient::mount`. See `Guzzle\Http\StaticClient::mount`.
* Added `command.request_options` to `Guzzle\Service\Command\AbstractCommand` to pass request options to requests * Added `command.request_options` to `Guzzle\Service\Command\AbstractCommand` to pass request options to requests
created by a command (e.g. custom headers, query string variables, timeout settings, etc). created by a command (e.g. custom headers, query string variables, timeout settings, etc.).
* Stream size in `Guzzle\Stream\PhpStreamRequestFactory` will now be set if Content-Length is returned in the * Stream size in `Guzzle\Stream\PhpStreamRequestFactory` will now be set if Content-Length is returned in the
headers of a response headers of a response
* Added `Guzzle\Common\Collection::setPath($path, $value)` to set a value into an array using a nested key * Added `Guzzle\Common\Collection::setPath($path, $value)` to set a value into an array using a nested key
...@@ -251,7 +281,7 @@ CHANGELOG ...@@ -251,7 +281,7 @@ CHANGELOG
* Removed Guzzle\Parser\ParserRegister::get(). Use getParser() * Removed Guzzle\Parser\ParserRegister::get(). Use getParser()
* Removed Guzzle\Parser\ParserRegister::set(). Use registerParser(). * Removed Guzzle\Parser\ParserRegister::set(). Use registerParser().
* All response header helper functions return a string rather than mixing Header objects and strings inconsistently * All response header helper functions return a string rather than mixing Header objects and strings inconsistently
* Removed cURL blacklist support. This is no longer necessary now that Expect, Accept, etc are managed by Guzzle * Removed cURL blacklist support. This is no longer necessary now that Expect, Accept, etc. are managed by Guzzle
directly via interfaces directly via interfaces
* Removed the injecting of a request object onto a response object. The methods to get and set a request still exist * Removed the injecting of a request object onto a response object. The methods to get and set a request still exist
but are a no-op until removed. but are a no-op until removed.
...@@ -508,7 +538,7 @@ CHANGELOG ...@@ -508,7 +538,7 @@ CHANGELOG
3.0.1 (2012-10-22) 3.0.1 (2012-10-22)
------------------ ------------------
* Models can now be used like regular collection objects by calling filter, map, etc * Models can now be used like regular collection objects by calling filter, map, etc.
* Models no longer require a Parameter structure or initial data in the constructor * Models no longer require a Parameter structure or initial data in the constructor
* Added a custom AppendIterator to get around a PHP bug with the `\AppendIterator` * Added a custom AppendIterator to get around a PHP bug with the `\AppendIterator`
...@@ -800,6 +830,6 @@ CHANGELOG ...@@ -800,6 +830,6 @@ CHANGELOG
* Emitting an event each time a client is generated by a ServiceBuilder * Emitting an event each time a client is generated by a ServiceBuilder
* Using an ApiParams object instead of a Collection for parameters of an ApiCommand * Using an ApiParams object instead of a Collection for parameters of an ApiCommand
* cache.* request parameters should be renamed to params.cache.* * cache.* request parameters should be renamed to params.cache.*
* Added the ability to set arbitrary curl options on requests (disable_wire, progress, etc). See CurlHandle. * Added the ability to set arbitrary curl options on requests (disable_wire, progress, etc.). See CurlHandle.
* Added the ability to disable type validation of service descriptions * Added the ability to disable type validation of service descriptions
* ServiceDescriptions and ServiceBuilders are now Serializable * ServiceDescriptions and ServiceBuilders are now Serializable
...@@ -24,7 +24,7 @@ var_export($res->json()); ...@@ -24,7 +24,7 @@ var_export($res->json());
- Doesn't require cURL, but uses cURL by default - Doesn't require cURL, but uses cURL by default
- Streams data for both uploads and downloads - Streams data for both uploads and downloads
- Provides event hooks & plugins for cookies, caching, logging, OAuth, mocks, - Provides event hooks & plugins for cookies, caching, logging, OAuth, mocks,
etc... etc.
- Keep-Alive & connection pooling - Keep-Alive & connection pooling
- SSL Verification - SSL Verification
- Automatic decompression of response bodies - Automatic decompression of response bodies
......
...@@ -59,7 +59,7 @@ Guzzle no longer requires Symfony's EventDispatcher component. Guzzle now uses ...@@ -59,7 +59,7 @@ Guzzle no longer requires Symfony's EventDispatcher component. Guzzle now uses
`GuzzleHttp\Event\EventInterface`. `GuzzleHttp\Event\EventInterface`.
- `AbstractHasDispatcher` has moved to a trait, `HasEmitterTrait`, and - `AbstractHasDispatcher` has moved to a trait, `HasEmitterTrait`, and
`HasDispatcherInterface` has moved to `HasEmitterInterface`. Retrieving the `HasDispatcherInterface` has moved to `HasEmitterInterface`. Retrieving the
event emitter of a request, client, etc now uses the `getEmitter` method event emitter of a request, client, etc. now uses the `getEmitter` method
rather than the `getDispatcher` method. rather than the `getDispatcher` method.
#### Emitter #### Emitter
...@@ -152,7 +152,7 @@ $response = $client->send($request); ...@@ -152,7 +152,7 @@ $response = $client->send($request);
- The client no longer emits a `client.create_request` event. - The client no longer emits a `client.create_request` event.
- Creating requests with a client no longer automatically utilize a URI - Creating requests with a client no longer automatically utilize a URI
template. You must pass an array into a creational method (e.g., template. You must pass an array into a creational method (e.g.,
`createRequest`, `get`, `put`, etc...) in order to expand a URI template. `createRequest`, `get`, `put`, etc.) in order to expand a URI template.
### Messages ### Messages
...@@ -444,7 +444,7 @@ that contain additonal metadata accessible via `getMetadata()`. ...@@ -444,7 +444,7 @@ that contain additonal metadata accessible via `getMetadata()`.
`GuzzleHttp\Stream\StreamInterface::getMetadata` and `GuzzleHttp\Stream\StreamInterface::getMetadata` and
`GuzzleHttp\Stream\StreamInterface::setMetadata` have been removed. `GuzzleHttp\Stream\StreamInterface::setMetadata` have been removed.
## SteamRequestFactory ## StreamRequestFactory
The entire concept of the StreamRequestFactory has been removed. The way this The entire concept of the StreamRequestFactory has been removed. The way this
was used in Guzzle 3 broke the actual interface of sending streaming requests was used in Guzzle 3 broke the actual interface of sending streaming requests
...@@ -563,7 +563,7 @@ that implement them, but you should update your code to use alternative methods: ...@@ -563,7 +563,7 @@ that implement them, but you should update your code to use alternative methods:
* Moved getLinks() from Response to just be used on a Link header object. * Moved getLinks() from Response to just be used on a Link header object.
If you previously relied on Guzzle\Http\Message\Header::raw(), then you will need to update your code to use the If you previously relied on Guzzle\Http\Message\Header::raw(), then you will need to update your code to use the
HeaderInterface (e.g. toArray(), getAll(), etc). HeaderInterface (e.g. toArray(), getAll(), etc.).
### Interface changes ### Interface changes
...@@ -591,7 +591,7 @@ HeaderInterface (e.g. toArray(), getAll(), etc). ...@@ -591,7 +591,7 @@ HeaderInterface (e.g. toArray(), getAll(), etc).
### Other changes ### Other changes
* All response header helper functions return a string rather than mixing Header objects and strings inconsistently * All response header helper functions return a string rather than mixing Header objects and strings inconsistently
* Removed cURL blacklist support. This is no longer necessary now that Expect, Accept, etc are managed by Guzzle * Removed cURL blacklist support. This is no longer necessary now that Expect, Accept, etc. are managed by Guzzle
directly via interfaces directly via interfaces
* Removed the injecting of a request object onto a response object. The methods to get and set a request still exist * Removed the injecting of a request object onto a response object. The methods to get and set a request still exist
but are a no-op until removed. but are a no-op until removed.
...@@ -619,7 +619,7 @@ The `Guzzle\Http\Utils` class was removed. This class was only used for testing. ...@@ -619,7 +619,7 @@ The `Guzzle\Http\Utils` class was removed. This class was only used for testing.
### Stream wrapper and type ### Stream wrapper and type
`Guzzle\Stream\Stream::getWrapper()` and `Guzzle\Stream\Stream::getSteamType()` are no longer converted to lowercase. `Guzzle\Stream\Stream::getWrapper()` and `Guzzle\Stream\Stream::getStreamType()` are no longer converted to lowercase.
### curl.emit_io became emit_io ### curl.emit_io became emit_io
......
...@@ -16,7 +16,12 @@ ...@@ -16,7 +16,12 @@
"require": { "require": {
"php": ">=5.4.0", "php": ">=5.4.0",
"guzzlehttp/streams": "1.*" "ext-json": "*",
"guzzlehttp/streams": "~1.0"
},
"suggest": {
"ext-curl": "Guzzle will use specific adapters if cURL is present"
}, },
"autoload": { "autoload": {
...@@ -28,8 +33,8 @@ ...@@ -28,8 +33,8 @@
"require-dev": { "require-dev": {
"ext-curl": "*", "ext-curl": "*",
"psr/log": "~1", "psr/log": "~1.0",
"phpunit/phpunit": "4.*" "phpunit/phpunit": "~4.0"
}, },
"extra": { "extra": {
......
...@@ -18,7 +18,7 @@ If cURL is present, Guzzle will use the following adapters by default: ...@@ -18,7 +18,7 @@ If cURL is present, Guzzle will use the following adapters by default:
``GuzzleHttp\Adapter\StreamingProxyAdapter`` is added so that streaming ``GuzzleHttp\Adapter\StreamingProxyAdapter`` is added so that streaming
requests are sent using the PHP stream wrapper. If this setting is disabled, requests are sent using the PHP stream wrapper. If this setting is disabled,
then streaming requests are sent through a cURL adapter. then streaming requests are sent through a cURL adapter.
- If using PHP 5.5 or greater, then a a ``GuzzleHttp\Adapter\Curl\CurlAdapter`` - If using PHP 5.5 or greater, then a ``GuzzleHttp\Adapter\Curl\CurlAdapter``
is used to send serial requests. Otherwise, the is used to send serial requests. Otherwise, the
``GuzzleHttp\Adapter\Curl\MultiAdapter`` is used for serial and parallel ``GuzzleHttp\Adapter\Curl\MultiAdapter`` is used for serial and parallel
requests. requests.
......
...@@ -5,7 +5,7 @@ Clients ...@@ -5,7 +5,7 @@ Clients
Clients are used to create requests, create transactions, send requests Clients are used to create requests, create transactions, send requests
through an HTTP adapter, and return a response. You can add default request through an HTTP adapter, and return a response. You can add default request
options to a client that are applied to every request (e.g., default headers, options to a client that are applied to every request (e.g., default headers,
default query string parameters, etc), and you can add event listeners and default query string parameters, etc.), and you can add event listeners and
subscribers to every request created by a client. subscribers to every request created by a client.
Creating a client Creating a client
...@@ -56,6 +56,11 @@ defaults ...@@ -56,6 +56,11 @@ defaults
default headers (e.g., User-Agent), default query string parameters, SSL default headers (e.g., User-Agent), default query string parameters, SSL
configurations, and any other supported request options. configurations, and any other supported request options.
emitter
Specifies an event emitter (``GuzzleHttp\Event\EmitterInterface``) instance
to be used by the client to emit request events. This option is useful if
you need to inject an emitter with listeners/subscribers already attached.
Here's an example of creating a client with various options, including using Here's an example of creating a client with various options, including using
a mock adapter that just returns the result of a callable function and a a mock adapter that just returns the result of a callable function and a
base URL that is a URI template with parameters. base URL that is a URI template with parameters.
...@@ -245,7 +250,7 @@ request using event callbacks. ...@@ -245,7 +250,7 @@ request using event callbacks.
// Do something with the completion of the request... // Do something with the completion of the request...
}, },
'error' => function (ErrorEvent $event) { 'error' => function (ErrorEvent $event) {
echo 'Request failed: ' . $event->getRequest()->getUrl() . "\n" echo 'Request failed: ' . $event->getRequest()->getUrl() . "\n";
echo $event->getException(); echo $event->getException();
// Do something to handle the error... // Do something to handle the error...
} }
...@@ -297,7 +302,7 @@ immeditaley and prevent subsequent requests from being sent. ...@@ -297,7 +302,7 @@ immeditaley and prevent subsequent requests from being sent.
} }
]); ]);
.. _request-options: .. _batch-requests:
Batching Requests Batching Requests
----------------- -----------------
...@@ -338,6 +343,8 @@ events as well as specify the maximum number of request to send in parallel ...@@ -338,6 +343,8 @@ events as well as specify the maximum number of request to send in parallel
using the 'parallel' option key. This options array is the exact same format as using the 'parallel' option key. This options array is the exact same format as
the options array exposed in ``GuzzleHttp\ClientInterface::sendAll()``. the options array exposed in ``GuzzleHttp\ClientInterface::sendAll()``.
.. _request-options:
Request Options Request Options
=============== ===============
...@@ -425,6 +432,33 @@ This setting can be set to any of the following types: ...@@ -425,6 +432,33 @@ This setting can be set to any of the following types:
$stream = GuzzleHttp\Stream\Stream::factory('contents...'); $stream = GuzzleHttp\Stream\Stream::factory('contents...');
$client->post('/post', ['body' => $stream]); $client->post('/post', ['body' => $stream]);