Fixes image uploading tests without account.

This commit is contained in:
Vitor Pamplona
2023-08-15 11:10:17 -04:00
parent dca4f827fe
commit 52687a48df
@@ -140,7 +140,10 @@ object ImageUploader {
}
fun NIP98Header(url: String, method: String, body: String): String {
val noteJson = account.createHTTPAuthorization(url, method, body)?.toJson() ?: ""
val noteJson = if (this::account.isInitialized) {
account.createHTTPAuthorization(url, method, body)?.toJson() ?: ""
} else { "" }
val encodedNIP98Event: String = Base64.getEncoder().encodeToString(noteJson.toByteArray())
return "Nostr " + encodedNIP98Event
}