GzipFilter: Add Vary header for compressible responses even when not gzipped by tsawada · Pull Request #13822 · playframework/playframework

Pull Request Checklist

Purpose

Previously, the Vary: Accept-Encoding header was only added when the response was actually gzipped. Now it is also added when the response is compressible but not gzipped (e.g., when the client doesn't send Accept-Encoding: gzip).
I believe this behavior better conforms to the standard, because the Vary header must indicate that the response depends on the Accept-Encoding request header, preventing downstream caches from incorrectly serving a cached uncompressed response to subsequent clients that support compression.

The diff is larger than it should be, due to indentation changes. Please let me know if you have any suggestions to minimize it.

Part of #12981