FIX: on 404 from brotli asset path return a correctly encoded doc

old implementation would cache the 404 for 1 year with incorrect encoding

hilarity would ensue
This commit is contained in:
Sam
2016-12-15 16:05:20 +11:00
parent f867af6bf9
commit 98f4a2adcb
2 changed files with 20 additions and 9 deletions
@@ -3,6 +3,15 @@ require 'rails_helper'
describe StaticController do
context 'brotli_asset' do
it 'returns a brotli encoded 404 if asset is missing' do
get :brotli_asset, path: 'missing.js'
expect(response.status).to eq(404)
expect(response.headers['Content-Encoding']).not_to eq('br')
expect(response.headers["Cache-Control"]).to match(/max-age=5/)
end
it 'has correct headers for brotli assets' do
begin
assets_path = Rails.root.join("public/assets")