Skip to content

Commit

Permalink
Set content-type before writing status code
Browse files Browse the repository at this point in the history
  • Loading branch information
jlelse committed Sep 25, 2023
1 parent 75e6032 commit dfc1af4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion activityStreams.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))
}

Expand Down
8 changes: 4 additions & 4 deletions pkgs/httpcompress/httpCompress.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit dfc1af4

Please sign in to comment.