Gzip content when using HTTP::respond
I don't think what you're looking for is possible like the way you describe it.
Thinking out loud though, if your content is static you could serve it as a precompressed gzip file? Jason has an article about serving files via ifile here:
Oh, and if the content is brotli compatible and the client supports it you migth want to look into that as an alternative to gzip.