aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMS <ms@taler.net>2023-09-26 22:49:11 +0200
committerMS <ms@taler.net>2023-09-26 22:49:11 +0200
commitb0a2953609cb0303ea7d071296e87e6e62834112 (patch)
tree66a61002a7875c0302753ef0af15da27d18a8cdc
parent6e2bf1a4b94a2ca07429a816e4059ef538240af0 (diff)
downloadlibeufin-b0a2953609cb0303ea7d071296e87e6e62834112.tar.gz
libeufin-b0a2953609cb0303ea7d071296e87e6e62834112.tar.bz2
libeufin-b0a2953609cb0303ea7d071296e87e6e62834112.zip
Testing /admin/add-incoming with deflated request.
-rw-r--r--bank/src/main/kotlin/tech/libeufin/bank/Main.kt1
-rw-r--r--bank/src/test/kotlin/Common.kt11
-rw-r--r--bank/src/test/kotlin/TalerApiTest.kt5
m---------contrib/wallet-core0
4 files changed, 14 insertions, 3 deletions
diff --git a/bank/src/main/kotlin/tech/libeufin/bank/Main.kt b/bank/src/main/kotlin/tech/libeufin/bank/Main.kt
index b0d9d02c..eb88d15d 100644
--- a/bank/src/main/kotlin/tech/libeufin/bank/Main.kt
+++ b/bank/src/main/kotlin/tech/libeufin/bank/Main.kt
@@ -181,6 +181,7 @@ val corebankDecompressionPlugin = createApplicationPlugin("RequestingBodyDecompr
onCallReceive { call ->
transformBody { data ->
if (call.request.headers[HttpHeaders.ContentEncoding] == "deflate") {
+ logger.debug("Inflating request..")
val brc = try {
withContext(Dispatchers.IO) {
val inflated = InflaterInputStream(data.toInputStream())
diff --git a/bank/src/test/kotlin/Common.kt b/bank/src/test/kotlin/Common.kt
index 29fd01c0..425cff3a 100644
--- a/bank/src/test/kotlin/Common.kt
+++ b/bank/src/test/kotlin/Common.kt
@@ -18,7 +18,8 @@
*/
import tech.libeufin.bank.*
-import tech.libeufin.util.execCommand
+import java.io.ByteArrayOutputStream
+import java.util.zip.DeflaterOutputStream
/**
* Init the database and sets the currency to KUDOS.
@@ -47,4 +48,12 @@ fun getTestContext(
suggestedWithdrawalExchange = suggestedExchange,
spaCaptchaURL = null,
)
+}
+
+fun deflater(reqBody: String): ByteArray {
+ val bos = ByteArrayOutputStream()
+ val ios = DeflaterOutputStream(bos)
+ ios.write(reqBody.toByteArray())
+ ios.finish()
+ return bos.toByteArray()
} \ No newline at end of file
diff --git a/bank/src/test/kotlin/TalerApiTest.kt b/bank/src/test/kotlin/TalerApiTest.kt
index 61071327..8bdcc283 100644
--- a/bank/src/test/kotlin/TalerApiTest.kt
+++ b/bank/src/test/kotlin/TalerApiTest.kt
@@ -180,12 +180,13 @@ class TalerApiTest {
expectSuccess = true
contentType(ContentType.Application.Json)
basicAuth("foo", "pw")
- setBody("""
+ headers.set("Content-Encoding", "deflate")
+ setBody(deflater("""
{"amount": "KUDOS:44",
"reserve_pub": "RESERVE-PUB-TEST",
"debit_account": "BAR-IBAN-ABC"
}
- """.trimIndent())
+ """.trimIndent()))
}
}
}
diff --git a/contrib/wallet-core b/contrib/wallet-core
-Subproject 8a9eea812bd17a54fa63b5450d0c9e562700589
+Subproject c5a3cd4c50676c49fa6c67cbdeb609101c38e76