All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.http4k.security.digest.ParameterizedHeader.kt Maven / Gradle / Ivy

The newest version!
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)
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy