Skip to content

Commit f328825

Browse files
everlofp2
authored andcommitted
Fix warning(s): 'characters' is deprecated: Please use String or Substring directly (p2#251)
1 parent c456a82 commit f328825

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

Sources/Base/OAuth2Requestable.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,10 +197,10 @@ open class OAuth2Requestable {
197197
- returns: A dictionary full of strings with the key-value pairs found in the query
198198
*/
199199
public final class func params(fromQuery query: String) -> OAuth2StringDict {
200-
let parts = query.characters.split() { $0 == "&" }.map() { String($0) }
200+
let parts = query.split() { $0 == "&" }.map() { String($0) }
201201
var params = OAuth2StringDict(minimumCapacity: parts.count)
202202
for part in parts {
203-
let subparts = part.characters.split() { $0 == "=" }.map() { String($0) }
203+
let subparts = part.split() { $0 == "=" }.map() { String($0) }
204204
if 2 == subparts.count {
205205
params[subparts[0]] = subparts[1].wwwFormURLDecodedString
206206
}

Sources/Flows/OAuth2CodeGrant.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ open class OAuth2CodeGrant: OAuth2 {
133133
if !(redirect.absoluteString.hasPrefix(expectRedirect)) && (!(redirect.absoluteString.hasPrefix("urn:ietf:wg:oauth:2.0:oob")) && "localhost" != comp?.host) {
134134
throw OAuth2Error.invalidRedirectURL("Expecting «\(expectRedirect)» but received «\(redirect)»")
135135
}
136-
if let compQuery = comp?.query, compQuery.characters.count > 0 {
136+
if let compQuery = comp?.query, compQuery.count > 0 {
137137
let query = OAuth2CodeGrant.params(fromQuery: comp!.percentEncodedQuery!)
138138
try assureNoErrorInResponse(query as OAuth2JSON)
139139
if let cd = query["code"] {

Sources/Flows/OAuth2ImplicitGrant.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ open class OAuth2ImplicitGrant: OAuth2 {
4242
do {
4343
// token should be in the URL fragment
4444
let comp = URLComponents(url: redirect, resolvingAgainstBaseURL: true)
45-
guard let fragment = comp?.percentEncodedFragment, fragment.characters.count > 0 else {
45+
guard let fragment = comp?.percentEncodedFragment, fragment.count > 0 else {
4646
throw OAuth2Error.invalidRedirectURL(redirect.description)
4747
}
4848

0 commit comments

Comments
 (0)