diff --git a/activityStreams.go b/activityStreams.go index 467c0ff..9c5292f 100644 --- a/activityStreams.go +++ b/activityStreams.go @@ -171,8 +171,8 @@ func (a *goBlog) serveAPItem(w http.ResponseWriter, r *http.Request, status int, return } // Send response - w.WriteHeader(status) w.Header().Set(contentType, contenttype.ASUTF8) + w.WriteHeader(status) _ = a.min.Get().Minify(contenttype.AS, w, bytes.NewReader(binary)) } diff --git a/pkgs/httpcompress/httpCompress.go b/pkgs/httpcompress/httpCompress.go index bf50c00..3c4dd8f 100644 --- a/pkgs/httpcompress/httpCompress.go +++ b/pkgs/httpcompress/httpCompress.go @@ -62,10 +62,10 @@ type Compressor struct { func NewCompressor(level int, types ...string) *Compressor { // If types are provided, set those as the allowed types. If none are // provided, use the default list. - allowedTypes := map[string]any{} - for _, t := range lo.If(len(types) > 0, types).Else(defaultCompressibleContentTypes) { - allowedTypes[t] = nil - } + allowedTypes := lo.SliceToMap( + lo.If(len(types) > 0, types).Else(defaultCompressibleContentTypes), + func(t string) (string, any) { return t, nil }, + ) c := &Compressor{ level: level,