mirror of
https://code.castopod.org/adaures/castopod
synced 2025-04-19 13:01:19 +00:00
fix(router): check if Accept header is set before getting value
fix deprecation warnings for getHeader and getHeaders methods refs #228
This commit is contained in:
parent
e66bf44341
commit
10a2ae0248
@ -69,7 +69,7 @@ if (! function_exists('download_file')) {
|
||||
true,
|
||||
)
|
||||
) {
|
||||
$newFileUrl = trim($response->getHeader('location')->getValue());
|
||||
$newFileUrl = trim($response->header('location')->getValue());
|
||||
$response = $client->get($newFileUrl, [
|
||||
'headers' => [
|
||||
'User-Agent' => 'Castopod/' . CP_VERSION,
|
||||
|
@ -110,7 +110,12 @@ class Router extends CodeIgniterRouter
|
||||
$request = Services::request();
|
||||
$negotiate = Services::negotiator();
|
||||
|
||||
$acceptHeader = $request->getHeader('Accept')
|
||||
// Accept header is mandatory
|
||||
if ($request->header('Accept') === null) {
|
||||
break;
|
||||
}
|
||||
|
||||
$acceptHeader = $request->header('Accept')
|
||||
->getValue();
|
||||
$parsedHeader = $negotiate->parseHeader($acceptHeader);
|
||||
|
||||
|
@ -272,7 +272,7 @@ $error_id = uniqid('error', true); ?>
|
||||
|
||||
<?php endif; ?>
|
||||
|
||||
<?php $headers = $request->getHeaders(); ?>
|
||||
<?php $headers = $request->headers(); ?>
|
||||
<?php if (! empty($headers)) : ?>
|
||||
|
||||
<h3>Headers</h3>
|
||||
@ -320,7 +320,7 @@ $error_id = uniqid('error', true); ?>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<?php $headers = $response->getHeaders(); ?>
|
||||
<?php $headers = $response->headers(); ?>
|
||||
<?php if (! empty($headers)) : ?>
|
||||
<?php natsort($headers) ?>
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user