benkuly
scope.requestPipeline.intercept(HttpRequestPipeline.Render)
No request transformation found
intercept
Aleksei Tirman [JB]
scope.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}"""" ) }
sign
A modern programming language that makes developers happier.