if (isset($options['sink'
])) { // TODO: Add more sink validation?
if (\
is_bool($options['sink'
])) { throw new InvalidArgumentException('sink must not be a boolean'
);
} } if (isset($options['version'
])) { $modify['version'
] =
$options['version'
];
} $request = Psr7\Utils::
modifyRequest($request,
$modify);
if ($request->
getBody() instanceof Psr7\MultipartStream
) { // Use a multipart/form-data POST if a Content-Type is not set.
// Ensure that we don't have the header in different case and set the new value.
$options['_conditional'
] = Psr7\Utils::
caselessRemove(['Content-Type'
],
$options['_conditional'
]);
$options['_conditional'
]['Content-Type'
] = 'multipart/form-data; boundary='
.
$request->
getBody()->
getBoundary();
} // Merge in conditional headers if they are not present.
if (isset($options['_conditional'
])) { // Build up the changes so it's in a single clone of the message.