Eliminate hasPrefix usage for pseudo HTTP header names (#87)

UTF8 view is faster than hasPrefix

rdar://144395951
This commit is contained in:
Guoye Zhang authored and GitHub committed 2025-02-15 18:14:25 -08:00
1 parent 99d1c41bac
commit 4bd2f8104f
3 files changed
+5 -5

No files matched your search

+1 -1
View File
@@ -298,7 +298,7 @@ extension HTTPRequest.PseudoHeaderFields: Codable {
}
extendedConnectProtocol = field
default:
guard field.name.rawName.hasPrefix(":") else {
guard field.name.rawName.utf8.first == UInt8(ascii: ":") else {
throw DecodingError.dataCorruptedError(
in: container,
debugDescription: "\"\(field)\" is not a pseudo header field"