Skip to content

Commit

Permalink
add compression back in the response header
Browse files Browse the repository at this point in the history
  • Loading branch information
tzhao-viant committed Aug 29, 2024
1 parent 409ce60 commit 7708254
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions gateway/router/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,10 @@ func (r *Handler) writeResponse(ctx context.Context, request *http.Request, writ
for key, value := range aResponse.Headers() {
writer.Header().Add(key, value[0])
}

compressed, ok := aResponse.(response.Compressed)
if ok && compressed.CompressionType() != "" {
writer.Header().Add(acontent.Encoding, compressed.CompressionType())
}
statusCode := http.StatusOK
if aResponse.StatusCode() > 0 {
statusCode = aResponse.StatusCode()
Expand Down Expand Up @@ -290,7 +293,6 @@ func (r *Handler) PreSign(ctx context.Context, viewName string, aResponse respon
return nil, fmt.Errorf("response is not compressed")
}
compressionType := compressed.CompressionType()

if compressionType != "" {
kv = append(kv, acontent.Encoding, compressionType)
}
Expand Down

0 comments on commit 7708254

Please sign in to comment.