diff --git a/Sources/Main/Services/FormPost.swift b/Sources/Main/Services/FormPost.swift index 940aeee..efab0dc 100644 --- a/Sources/Main/Services/FormPost.swift +++ b/Sources/Main/Services/FormPost.swift @@ -37,8 +37,9 @@ public struct FormPost: Request { if let formDataString, formDataString.isEmpty { return JSON(formData).rawString()?.data(using: .utf8) + } else { + return formDataString?.data(using: .utf8) } - return formDataString?.data(using: .utf8) } /// The form data for the request. diff --git a/Tests/Helpers/Wallet.swift b/Tests/Helpers/Wallet.swift index 689b3c2..f5ebf67 100644 --- a/Tests/Helpers/Wallet.swift +++ b/Tests/Helpers/Wallet.swift @@ -242,28 +242,21 @@ extension Wallet { var unAuthorized: Result var authorizationCode: String - // Depending on the mode selected, changes might be - // required on the tests constants file (endpoints, scopes) - let legacyIssuer = true - - if legacyIssuer { - authorizationCode = try await loginUserAndGetAuthCode( - getAuthorizationCodeUrl: parRequested.getAuthorizationCodeURL.url, - actingUser: actingUser - ) ?? { throw ValidationError.error(reason: "Could not retrieve authorization code") }() - let issuanceAuthorization: IssuanceAuthorization = .authorizationCode(authorizationCode: authorizationCode) - unAuthorized = await issuer.handleAuthorizationCode( - parRequested: request, - authorizationCode: issuanceAuthorization - ) - } else { + authorizationCode = try await loginUserAndGetAuthCode( + getAuthorizationCodeUrl: parRequested.getAuthorizationCodeURL.url, + actingUser: actingUser + ) ?? { throw ValidationError.error(reason: "Could not retrieve authorization code") }() + let issuanceAuthorization: IssuanceAuthorization = .authorizationCode(authorizationCode: authorizationCode) + unAuthorized = await issuer.handleAuthorizationCode( + parRequested: request, + authorizationCode: issuanceAuthorization + ) - authorizationCode = "" - unAuthorized = await issuer.handleAuthorizationCode( - parRequested: request, - code: &authorizationCode - ) - } +// authorizationCode = "" +// unAuthorized = await issuer.handleAuthorizationCode( +// parRequested: request, +// code: &authorizationCode +// ) print("--> [AUTHORIZATION] Authorization code retrieved: \(authorizationCode)")