Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[fix] minot fixes #7

Merged
merged 1 commit into from
Jan 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Sources/Main/Services/FormPost.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
35 changes: 14 additions & 21 deletions Tests/Helpers/Wallet.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)")

Expand Down