File tree Expand file tree Collapse file tree 3 files changed +5
-5
lines changed Expand file tree Collapse file tree 3 files changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -61,7 +61,7 @@ extension HTTPField {
61
61
return nil
62
62
}
63
63
let token : Substring
64
- if name. hasPrefix ( " : " ) {
64
+ if name. utf8 . first == UInt8 ( ascii : " : " ) {
65
65
token = name. dropFirst ( )
66
66
} else {
67
67
token = Substring ( name)
@@ -90,7 +90,7 @@ extension HTTPField {
90
90
}
91
91
92
92
var isPseudo : Bool {
93
- self . rawName. hasPrefix ( " : " )
93
+ self . rawName. utf8 . first == UInt8 ( ascii : " : " )
94
94
}
95
95
}
96
96
}
@@ -126,7 +126,7 @@ extension HTTPField.Name: Codable {
126
126
public init ( from decoder: Decoder ) throws {
127
127
let container = try decoder. singleValueContainer ( )
128
128
let nameString = try container. decode ( String . self)
129
- if nameString. hasPrefix ( " : " ) {
129
+ if nameString. utf8 . first == UInt8 ( ascii : " : " )
130
130
guard nameString. lowercased ( ) == nameString,
131
131
HTTPField . isValidToken ( nameString. dropFirst ( ) )
132
132
else {
Original file line number Diff line number Diff line change @@ -298,7 +298,7 @@ extension HTTPRequest.PseudoHeaderFields: Codable {
298
298
}
299
299
extendedConnectProtocol = field
300
300
default :
301
- guard field. name. rawName. hasPrefix ( " : " ) else {
301
+ guard field. name. rawName. utf8 . first == UInt8 ( ascii : " : " ) else {
302
302
throw DecodingError . dataCorruptedError (
303
303
in: container,
304
304
debugDescription: " \" \( field) \" is not a pseudo header field "
Original file line number Diff line number Diff line change @@ -239,7 +239,7 @@ extension HTTPResponse.PseudoHeaderFields: Codable {
239
239
}
240
240
status = field
241
241
default :
242
- guard field. name. rawName. hasPrefix ( " : " ) else {
242
+ guard field. name. rawName. utf8 . first == UInt8 ( ascii : " : " ) else {
243
243
throw DecodingError . dataCorruptedError (
244
244
in: container,
245
245
debugDescription: " \" \( field) \" is not a pseudo header field "
You can’t perform that action at this time.
0 commit comments