Skip to content

Commit 8057c4b

Browse files
committed
Merge main into layout
2 parents b24a737 + 4bd2f81 commit 8057c4b

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

Sources/HTTPTypes/HTTPFieldName.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ extension HTTPField {
6161
return nil
6262
}
6363
let token: Substring
64-
if name.hasPrefix(":") {
64+
if name.utf8.first == UInt8(ascii: ":") {
6565
token = name.dropFirst()
6666
} else {
6767
token = Substring(name)
@@ -90,7 +90,7 @@ extension HTTPField {
9090
}
9191

9292
var isPseudo: Bool {
93-
self.rawName.hasPrefix(":")
93+
self.rawName.utf8.first == UInt8(ascii: ":")
9494
}
9595
}
9696
}
@@ -126,7 +126,7 @@ extension HTTPField.Name: Codable {
126126
public init(from decoder: Decoder) throws {
127127
let container = try decoder.singleValueContainer()
128128
let nameString = try container.decode(String.self)
129-
if nameString.hasPrefix(":") {
129+
if nameString.utf8.first == UInt8(ascii: ":") {
130130
guard nameString.lowercased() == nameString,
131131
HTTPField.isValidToken(nameString.dropFirst())
132132
else {

Sources/HTTPTypes/HTTPRequest.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,7 @@ extension HTTPRequest.PseudoHeaderFields: Codable {
401401
}
402402
extendedConnectProtocol = field
403403
default:
404-
guard field.name.rawName.hasPrefix(":") else {
404+
guard field.name.rawName.utf8.first == UInt8(ascii: ":") else {
405405
throw DecodingError.dataCorruptedError(
406406
in: container,
407407
debugDescription: "\"\(field)\" is not a pseudo header field"

Sources/HTTPTypes/HTTPResponse.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ extension HTTPResponse.PseudoHeaderFields: Codable {
284284
}
285285
status = field
286286
default:
287-
guard field.name.rawName.hasPrefix(":") else {
287+
guard field.name.rawName.utf8.first == UInt8(ascii: ":") else {
288288
throw DecodingError.dataCorruptedError(
289289
in: container,
290290
debugDescription: "\"\(field)\" is not a pseudo header field"

0 commit comments

Comments
 (0)