Skip to content

Commit

Permalink
Fix warning(s): `'characters' is deprecated: Please use String or Sub…
Browse files Browse the repository at this point in the history
…string directly` (#251)
  • Loading branch information
everlof authored and p2 committed Feb 9, 2018
1 parent c456a82 commit f328825
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions Sources/Base/OAuth2Requestable.swift
Original file line number Diff line number Diff line change
Expand Up @@ -197,10 +197,10 @@ open class OAuth2Requestable {
- returns: A dictionary full of strings with the key-value pairs found in the query
*/
public final class func params(fromQuery query: String) -> OAuth2StringDict {
let parts = query.characters.split() { $0 == "&" }.map() { String($0) }
let parts = query.split() { $0 == "&" }.map() { String($0) }
var params = OAuth2StringDict(minimumCapacity: parts.count)
for part in parts {
let subparts = part.characters.split() { $0 == "=" }.map() { String($0) }
let subparts = part.split() { $0 == "=" }.map() { String($0) }
if 2 == subparts.count {
params[subparts[0]] = subparts[1].wwwFormURLDecodedString
}
Expand Down
2 changes: 1 addition & 1 deletion Sources/Flows/OAuth2CodeGrant.swift
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ open class OAuth2CodeGrant: OAuth2 {
if !(redirect.absoluteString.hasPrefix(expectRedirect)) && (!(redirect.absoluteString.hasPrefix("urn:ietf:wg:oauth:2.0:oob")) && "localhost" != comp?.host) {
throw OAuth2Error.invalidRedirectURL("Expecting «\(expectRedirect)» but received «\(redirect)»")
}
if let compQuery = comp?.query, compQuery.characters.count > 0 {
if let compQuery = comp?.query, compQuery.count > 0 {
let query = OAuth2CodeGrant.params(fromQuery: comp!.percentEncodedQuery!)
try assureNoErrorInResponse(query as OAuth2JSON)
if let cd = query["code"] {
Expand Down
2 changes: 1 addition & 1 deletion Sources/Flows/OAuth2ImplicitGrant.swift
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ open class OAuth2ImplicitGrant: OAuth2 {
do {
// token should be in the URL fragment
let comp = URLComponents(url: redirect, resolvingAgainstBaseURL: true)
guard let fragment = comp?.percentEncodedFragment, fragment.characters.count > 0 else {
guard let fragment = comp?.percentEncodedFragment, fragment.count > 0 else {
throw OAuth2Error.invalidRedirectURL(redirect.description)
}

Expand Down

0 comments on commit f328825

Please sign in to comment.