Skip to content

Commit

Permalink
Merge pull request #7 from niscy-eudiw/feature/form-post-fix
Browse files Browse the repository at this point in the history
[fix] minot fixes
  • Loading branch information
dtsiflit authored Jan 29, 2024
2 parents 75fed38 + 0a0d020 commit 9315a4a
Showing 2 changed files with 16 additions and 22 deletions.
3 changes: 2 additions & 1 deletion Sources/Main/Services/FormPost.swift
Original file line number Diff line number Diff line change
@@ -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.
35 changes: 14 additions & 21 deletions Tests/Helpers/Wallet.swift
Original file line number Diff line number Diff line change
@@ -242,28 +242,21 @@ extension Wallet {
var unAuthorized: Result<UnauthorizedRequest, Error>
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)")

0 comments on commit 9315a4a

Please sign in to comment.