Skip to content

Commit cae024c

Browse files
authored
fix: make Authorization header check case-insensitive (#1528)
- Fix issue #1043 where custom Authorization headers were checked case-sensitively - HTTP headers should be case-insensitive according to RFC standards - Replace exact key match with case-insensitive check using Object.keys().some() - This allows headers like 'authorization', 'Authorization', 'AUTHORIZATION' to work correctly
1 parent 9850f01 commit cae024c

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/SupabaseClient.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,9 @@ export default class SupabaseClient<
344344
fetch,
345345
// auth checks if there is a custom authorizaiton header using this flag
346346
// so it knows whether to return an error when getUser is called with no session
347-
hasCustomAuthorizationHeader: 'Authorization' in this.headers,
347+
hasCustomAuthorizationHeader: Object.keys(this.headers).some(
348+
(key) => key.toLowerCase() === 'authorization'
349+
),
348350
})
349351
}
350352

0 commit comments

Comments
 (0)