when generating Authentication-Results, put each method on a new line for better readability

This commit is contained in:
Mechiel Lukkien
2023-12-14 15:14:07 +01:00
parent 406fdc312d
commit 2710a5b971
3 changed files with 15 additions and 2 deletions

View File

@ -66,6 +66,8 @@ func (h AuthResults) Header() string {
w := &HeaderWriter{}
w.Add("", "Authentication-Results:"+optComment(h.Comment)+" "+value(h.Hostname)+";")
for i, m := range h.Methods {
w.Newline()
tokens := []string{}
addf := func(format string, args ...any) {
s := fmt.Sprintf(format, args...)
@ -86,10 +88,14 @@ func (h AuthResults) Header() string {
addf("%s.%s=%s%s", p.Type, p.Property, v, optComment(p.Comment))
}
for j, t := range tokens {
var sep string
if j > 0 {
sep = " "
}
if j == len(tokens)-1 && i < len(h.Methods)-1 {
t += ";"
}
w.Add(" ", t)
w.Add(sep, t)
}
}
return w.String()