mirror of
https://github.com/guzzle/guzzle.git
synced 2025-02-24 18:13:00 +01:00
Cleaning up body listener
This commit is contained in:
parent
8da3b93d2e
commit
266f59e712
@ -21,12 +21,17 @@ class PrepareRequestBodySubscriber implements EventSubscriberInterface
|
|||||||
$request = $event->getRequest();
|
$request = $event->getRequest();
|
||||||
|
|
||||||
// Set the appropriate Content-Type for a request if one is not set and there are form fields
|
// Set the appropriate Content-Type for a request if one is not set and there are form fields
|
||||||
if ($body = $request->getBody()) {
|
if (!($body = $request->getBody())) {
|
||||||
// Synchronize the POST body with the request's headers
|
return;
|
||||||
if ($body instanceof PostBodyInterface) {
|
}
|
||||||
$body->applyRequestHeaders($request);
|
|
||||||
}
|
// Synchronize the POST body with the request's headers
|
||||||
// Determine if the Expect header should be used
|
if ($body instanceof PostBodyInterface) {
|
||||||
|
$body->applyRequestHeaders($request);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Determine if the Expect header should be used
|
||||||
|
if (!$request->hasHeader('Expect')) {
|
||||||
$addExpect = false;
|
$addExpect = false;
|
||||||
if (null !== ($expect = $request->getConfig()['expect'])) {
|
if (null !== ($expect = $request->getConfig()['expect'])) {
|
||||||
$size = $body->getSize();
|
$size = $body->getSize();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user