mirror of
https://github.com/openziti/zrok.git
synced 2024-11-27 02:23:23 +01:00
30 lines
456 B
Go
30 lines
456 B
Go
package util
|
|
|
|
import (
|
|
"fmt"
|
|
"net/http"
|
|
"sort"
|
|
)
|
|
|
|
func DumpHeaders(headers http.Header, in bool) string {
|
|
out := "headers {\n"
|
|
keys := make([]string, len(headers))
|
|
i := 0
|
|
for k, _ := range headers {
|
|
keys[i] = k
|
|
i++
|
|
}
|
|
sort.Strings(keys)
|
|
for _, k := range keys {
|
|
for _, v := range headers[k] {
|
|
indicator := "->"
|
|
if !in {
|
|
indicator = "<-"
|
|
}
|
|
out += fmt.Sprintf("\t%v %v: %v\n", indicator, k, v)
|
|
}
|
|
}
|
|
out += "}"
|
|
return out
|
|
}
|