org.http4k.security.digest.ParameterizedHeader.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of http4k-security-digest Show documentation
Show all versions of http4k-security-digest Show documentation
Http4k Security Digest support
package org.http4k.security.digest
data class ParameterizedHeader(
val prefix: String,
val parameters: Map
) {
companion object {
fun parse(headerValue: String): ParameterizedHeader {
val (prefix, parameterList) = headerValue.trim().split(" ", limit = 2)
val parameters = parameterList
.split(",")
.filter { "=" in it }
.associate {
val (key, value) = it.trim().split("=", limit = 2)
key.trim() to value.trim().replace("\"", "")
}
return ParameterizedHeader(prefix, parameters)
}
}
}