Skip to content

Commit bfc4728

Browse files
authored
Fix case sensitivity for http header (#283)
1 parent 06917f6 commit bfc4728

3 files changed

Lines changed: 3 additions & 3 deletions

File tree

src/Client/Transport/HttpTransport.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ public function send(string $data): void
122122
$this->logger->debug('Received session ID', ['session_id' => $this->sessionId]);
123123
}
124124

125-
$contentType = $response->getHeaderLine('Content-Type');
125+
$contentType = strtolower($response->getHeaderLine('Content-Type'));
126126

127127
if (str_contains($contentType, 'text/event-stream')) {
128128
$this->activeStream = $response->getBody();

src/Server/Transport/Http/Middleware/AuthorizationMiddleware.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ private function applyAttributes(ServerRequestInterface $request, array $attribu
166166

167167
private function parseBearerToken(string $authorization): ?string
168168
{
169-
if (!preg_match('/^Bearer\\s+(.+)$/', $authorization, $matches)) {
169+
if (!preg_match('/^Bearer\\s+(.+)$/i', $authorization, $matches)) {
170170
return null;
171171
}
172172

src/Server/Transport/Http/Middleware/ClientRegistrationMiddleware.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public function process(ServerRequestInterface $request, RequestHandlerInterface
7070
private function handleRegistration(ServerRequestInterface $request): ResponseInterface
7171
{
7272
$contentType = $request->getHeaderLine('Content-Type');
73-
if (!str_starts_with($contentType, 'application/json')) {
73+
if (!str_starts_with(strtolower($contentType), 'application/json')) {
7474
return $this->jsonResponse(400, [
7575
'error' => 'invalid_client_metadata',
7676
'error_description' => 'Content-Type must be application/json.',

0 commit comments

Comments
 (0)