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 @@ -401,7 +401,7 @@ extension HTTPRequest.PseudoHeaderFields: Codable {
401
401
}
402
402
extendedConnectProtocol = field
403
403
default :
404
- guard field. name. rawName. hasPrefix ( " : " ) else {
404
+ guard field. name. rawName. utf8 . first == UInt8 ( ascii : " : " ) else {
405
405
throw DecodingError . dataCorruptedError (
406
406
in: container,
407
407
debugDescription: " \" \( field) \" is not a pseudo header field "
Original file line number Diff line number Diff line change @@ -284,7 +284,7 @@ extension HTTPResponse.PseudoHeaderFields: Codable {
284
284
}
285
285
status = field
286
286
default :
287
- guard field. name. rawName. hasPrefix ( " : " ) else {
287
+ guard field. name. rawName. utf8 . first == UInt8 ( ascii : " : " ) else {
288
288
throw DecodingError . dataCorruptedError (
289
289
in: container,
290
290
debugDescription: " \" \( field) \" is not a pseudo header field "
You can’t perform that action at this time.
0 commit comments