Fix case sensitivity for http header (#283)
This commit is contained in:
parent
06917f6af6
commit
bfc4728792
3 changed files with 3 additions and 3 deletions
|
|
@ -122,7 +122,7 @@ class HttpTransport extends BaseTransport
|
||||||
$this->logger->debug('Received session ID', ['session_id' => $this->sessionId]);
|
$this->logger->debug('Received session ID', ['session_id' => $this->sessionId]);
|
||||||
}
|
}
|
||||||
|
|
||||||
$contentType = $response->getHeaderLine('Content-Type');
|
$contentType = strtolower($response->getHeaderLine('Content-Type'));
|
||||||
|
|
||||||
if (str_contains($contentType, 'text/event-stream')) {
|
if (str_contains($contentType, 'text/event-stream')) {
|
||||||
$this->activeStream = $response->getBody();
|
$this->activeStream = $response->getBody();
|
||||||
|
|
|
||||||
|
|
@ -166,7 +166,7 @@ final class AuthorizationMiddleware implements MiddlewareInterface
|
||||||
|
|
||||||
private function parseBearerToken(string $authorization): ?string
|
private function parseBearerToken(string $authorization): ?string
|
||||||
{
|
{
|
||||||
if (!preg_match('/^Bearer\\s+(.+)$/', $authorization, $matches)) {
|
if (!preg_match('/^Bearer\\s+(.+)$/i', $authorization, $matches)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -70,7 +70,7 @@ final class ClientRegistrationMiddleware implements MiddlewareInterface
|
||||||
private function handleRegistration(ServerRequestInterface $request): ResponseInterface
|
private function handleRegistration(ServerRequestInterface $request): ResponseInterface
|
||||||
{
|
{
|
||||||
$contentType = $request->getHeaderLine('Content-Type');
|
$contentType = $request->getHeaderLine('Content-Type');
|
||||||
if (!str_starts_with($contentType, 'application/json')) {
|
if (!str_starts_with(strtolower($contentType), 'application/json')) {
|
||||||
return $this->jsonResponse(400, [
|
return $this->jsonResponse(400, [
|
||||||
'error' => 'invalid_client_metadata',
|
'error' => 'invalid_client_metadata',
|
||||||
'error_description' => 'Content-Type must be application/json.',
|
'error_description' => 'Content-Type must be application/json.',
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue