mirror of
https://github.com/discourse/discourse.git
synced 2025-05-22 07:01:20 +08:00
FEATURE: brotli cdn bypass for assets
Allow CDNS that strip out brotli encoding to use brotli regardless
This commit is contained in:
@ -45,6 +45,16 @@ describe Middleware::AnonymousCache::Helper do
|
||||
crawler.clear_cache
|
||||
end
|
||||
|
||||
it "handles brotli switching" do
|
||||
helper.cache([200, {"HELLO" => "WORLD"}, ["hello ", "my world"]])
|
||||
|
||||
helper = new_helper("ANON_CACHE_DURATION" => 10)
|
||||
expect(helper.cached).to eq([200, {"X-Discourse-Cached" => "true", "HELLO" => "WORLD"}, ["hello my world"]])
|
||||
|
||||
helper = new_helper("ANON_CACHE_DURATION" => 10, "HTTP_ACCEPT_ENCODING" => "gz, br")
|
||||
expect(helper.cached).to eq(nil)
|
||||
end
|
||||
|
||||
it "returns cached data for cached requests" do
|
||||
helper.is_mobile = true
|
||||
expect(helper.cached).to eq(nil)
|
||||
|
Reference in New Issue
Block a user