benkuly
05/24/2022, 12:38 PMscope.requestPipeline.intercept(HttpRequestPipeline.Render)
I get No request transformation found
. Without intercept
it works (json with content negotiation). Any idea why?Aleksei Tirman [JB]
05/24/2022, 1:38 PMbenkuly
05/24/2022, 2:33 PMscope.requestPipeline.intercept(HttpRequestPipeline.State) { body ->
val content =
when (body) {
is EmptyContent -> null
is String -> json.encodeToJsonElement(body)
is JsonElement -> body
else -> return@intercept
}
val requestAuthenticationBody = json.encodeToString(
RequestAuthenticationBody(
method = context.method.value,
uri = context.url.encodedPath,
origin = hostname,
destination = "${context.host}:${context.port}",
content = content
)
)
val signature = sign(requestAuthenticationBody)
context.header(
HttpHeaders.Authorization,
"""X-Matrix origin="$hostname",key="${signature.algorithm.name}:${signature.keyId}",sig="${signature.value}""""
)
}
Aleksei Tirman [JB]
05/24/2022, 2:52 PMbenkuly
05/24/2022, 3:14 PMbenkuly
05/24/2022, 3:32 PMsign
function, which seems to be catched by intercept
and translated to this generic error message.