blob: e710fd973d2e341043a132fae557855c751e1b45 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
@file:JvmName("Headers")
package org.onap.vid.logging
import org.onap.portalsdk.core.util.SystemProperties.ECOMP_REQUEST_ID
import javax.servlet.http.HttpServletRequest
fun prioritizedRequestIdHeaders() = listOf(
"X-ONAP-RequestID",
"X-RequestID",
"X-TransactionID",
ECOMP_REQUEST_ID
)
fun highestPriorityHeader(httpRequest: HttpServletRequest): String? {
val headers = httpRequest.headerNames.asSequence().toSet().map { it.toUpperCase() }
return prioritizedRequestIdHeaders().firstOrNull { headers.contains(it.toUpperCase()) }
}
|