1
0
mirror of https://github.com/guzzle/guzzle.git synced 2025-02-24 10:03:27 +01:00

Cleaning up body listener

This commit is contained in:
Michael Dowling 2013-09-29 18:15:13 -07:00
parent 8da3b93d2e
commit 266f59e712

View File

@ -21,12 +21,17 @@ class PrepareRequestBodySubscriber implements EventSubscriberInterface
$request = $event->getRequest();
// Set the appropriate Content-Type for a request if one is not set and there are form fields
if ($body = $request->getBody()) {
// Synchronize the POST body with the request's headers
if ($body instanceof PostBodyInterface) {
$body->applyRequestHeaders($request);
}
// Determine if the Expect header should be used
if (!($body = $request->getBody())) {
return;
}
// Synchronize the POST body with the request's headers
if ($body instanceof PostBodyInterface) {
$body->applyRequestHeaders($request);
}
// Determine if the Expect header should be used
if (!$request->hasHeader('Expect')) {
$addExpect = false;
if (null !== ($expect = $request->getConfig()['expect'])) {
$size = $body->getSize();