This repository was archived by the owner on Feb 5, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +2
-17
lines changed
WordPressAuthenticator/OAuth Expand file tree Collapse file tree 2 files changed +2
-17
lines changed Original file line number Diff line number Diff line change @@ -3,18 +3,10 @@ enum OAuthError: LocalizedError {
33 // ASWebAuthenticationSession
44 case inconsistentWebAuthenticationSessionCompletion
55
6- // OAuth token request
7- case failedToBuildURLQuery
8- case failedToEncodeURLQuery( query: String )
9-
106 var errorDescription : String {
117 switch self {
128 case . inconsistentWebAuthenticationSessionCompletion:
139 return " ASWebAuthenticationSession authentication finished with neither a callback URL nor error "
14- case . failedToBuildURLQuery:
15- return " Failed to build URL query string "
16- case . failedToEncodeURLQuery( let query) :
17- return " Failed to encode URL query string ' \( query) ' "
1810 }
1911 }
2012}
Original file line number Diff line number Diff line change @@ -33,14 +33,7 @@ struct OAuthTokenRequestBody: Encodable {
3333 var components = URLComponents ( )
3434 components. queryItems = items
3535
36- guard let query = components. query else {
37- throw OAuthError . failedToBuildURLQuery
38- }
39-
40- guard let data = query. data ( using: . utf8) else {
41- throw OAuthError . failedToEncodeURLQuery ( query: query)
42- }
43-
44- return data
36+ // We can assume `query` to never be nil because we set `queryItems` in the line above.
37+ return Data ( components. query!. utf8)
4538 }
4639}
You can’t perform that action at this time.
0 commit comments