func (o Opts) Header() string {
	h := make([]string, 0)

	var fields = []struct {
		desc  string
		sites []string
	}{
		{"default-src", o.DefaultSrc},
		{"connect-src", o.ConnectSrc},
		{"frame-src", o.FrameSrc},
		{"font-src", o.FontSrc},
		{"img-src", o.ImgSrc},
		{"media-src", o.MediaSrc},
		{"object-src", o.ObjectSrc},
		{"style-src", o.StyleSrc},
		{"script-src", o.ScriptSrc},
	}
	for _, f := range fields {
		if f.sites != nil {
			h = append(h, f.desc+" "+strings.Join(f.sites, " "))
		}
	}
	if o.ReportUri != "" {
		h = append(h, "report-uri "+o.ReportUri)
	}
	return strings.Join(h, " ; ")
}
func (o Opts) Header() string {
	h := make([]string, 0)

	var fields = []struct {
		desc  string
		sites []string
	}{
		{"default-src", o.DefaultSrc},
		{"connect-src", o.ConnectSrc},
		{"frame-src", o.FrameSrc},
		{"font-src", o.FontSrc},
		{"img-src", o.ImgSrc},
		{"media-src", o.MediaSrc},
		{"object-src", o.ObjectSrc},
		{"style-src", o.StyleSrc},
		{"script-src", o.ScriptSrc},
	}
	for _, f := range fields {
		if f.sites != nil {
			h = append(h, f.desc+" "+strings.Join(f.sites, " "))
		}
	}
	if o.ReportUri != "" {
		h = append(h, "report-uri "+o.ReportUri)
	}
	return strings.Join(h, " ; ")
}
func ( o Opts ) Header ( ) string { h := make ( [ ] string , 0 ) var fields = [ ] struct { desc string sites [ ] string } { { " " , o . DefaultSrc } , { " " , o . ConnectSrc } , { " " , o . FrameSrc } , { " " , o . FontSrc } , { " " , o . ImgSrc } , { " " , o . MediaSrc } , { " " , o . ObjectSrc } , { " " , o . StyleSrc } , { " " , o . ScriptSrc } , } for _ , f := range fields { if f . sites != nil { h = append ( h , f . desc + " " + strings . Join ( f . sites , " " ) ) } } if o . ReportUri != " " { h = append ( h , " " + o . ReportUri ) } return strings . Join ( h , " " ) }
// Formats for rendering as an http header.
// E.G. default-src 'self' ; script-src 'self' https://apis.google.com
Formats for rendering as an http header . E . G . default - src self ; script - src self https : // apis . google . com