fix: Digestヘッダーにアルゴリズムを記載

This commit is contained in:
usbharu 2023-03-31 17:05:14 +09:00
parent 481f8aa295
commit 29174615a7
1 changed files with 2 additions and 1 deletions

View File

@ -59,10 +59,11 @@ val httpSignaturePlugin = createClientPlugin("HttpSign", ::HttpSignaturePluginCo
println(request.bodyType) println(request.bodyType)
println(request.bodyType?.type) println(request.bodyType?.type)
if (request.bodyType?.type == String::class) { if (request.bodyType?.type == String::class) {
println(body as String)
println("Digest !!") println("Digest !!")
val digest = val digest =
hex(UserAuthService.sha256.digest((body as String).toByteArray(Charsets.UTF_8))) hex(UserAuthService.sha256.digest((body as String).toByteArray(Charsets.UTF_8)))
request.headers.append("Digest", digest) request.headers.append("Digest", "sha-256="+digest)
} }
if (request.headers.contains("Signature")) { if (request.headers.contains("Signature")) {