Fix case sensitivity for http header (#283)

This commit is contained in:
Christopher Hertel 2026-05-12 23:20:14 +02:00 • committed by GitHub
commit bfc4728792
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 3 additions and 3 deletions

View file

@ -122,7 +122,7 @@ class HttpTransport extends BaseTransport
$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')) {
$this->activeStream = $response->getBody();

View file

@ -166,7 +166,7 @@ final class AuthorizationMiddleware implements MiddlewareInterface
private function parseBearerToken(string $authorization): ?string
{
if (!preg_match('/^Bearer\\s+(.+)$/', $authorization, $matches)) {
if (!preg_match('/^Bearer\\s+(.+)$/i', $authorization, $matches)) {
return null;
}

View file

@ -70,7 +70,7 @@ final class ClientRegistrationMiddleware implements MiddlewareInterface
private function handleRegistration(ServerRequestInterface $request): ResponseInterface
{
$contentType = $request->getHeaderLine('Content-Type');
if (!str_starts_with($contentType, 'application/json')) {
if (!str_starts_with(strtolower($contentType), 'application/json')) {
return $this->jsonResponse(400, [
'error' => 'invalid_client_metadata',
'error_description' => 'Content-Type must be application/json.',