[HttpClient] turn exception into log when the request has no content-type
This commit is contained in:
parent
74cfa364c0
commit
4c671a4487
@ -109,11 +109,18 @@ final class NativeResponse implements ResponseInterface
|
||||
|
||||
private function open(): void
|
||||
{
|
||||
set_error_handler(function ($type, $msg) { throw new TransportException($msg); });
|
||||
$url = $this->url;
|
||||
|
||||
set_error_handler(function ($type, $msg) use (&$url) {
|
||||
if (E_NOTICE !== $type || 'fopen(): Content-type not specified assuming application/x-www-form-urlencoded' !== $msg) {
|
||||
throw new TransportException($msg);
|
||||
}
|
||||
|
||||
$this->logger && $this->logger->info(sprintf('%s for "%s".', $msg, $url ?? $this->url));
|
||||
});
|
||||
|
||||
try {
|
||||
$this->info['start_time'] = microtime(true);
|
||||
$url = $this->url;
|
||||
|
||||
while (true) {
|
||||
$context = stream_context_get_options($this->context);
|
||||
|
Reference in New Issue
Block a user