add spec for brotli controller, ensure cached correctly
This commit is contained in:
parent
8a98d617df
commit
dc66f6681a
|
@ -145,6 +145,8 @@ class StaticController < ApplicationController
|
|||
raise Discourse::NotFound
|
||||
end
|
||||
|
||||
expires_in 1.year, public: true, must_revalidate: false
|
||||
|
||||
if File.exists?(path)
|
||||
send_file(path, opts)
|
||||
else
|
||||
|
|
|
@ -2,6 +2,18 @@ require 'rails_helper'
|
|||
|
||||
describe StaticController do
|
||||
|
||||
context 'brotli_asset' do
|
||||
it 'has correct headers for brotli assets' do
|
||||
FileUtils.mkdir_p(Rails.root + "public/assets/")
|
||||
File.write(Rails.root + "public/assets/test.js.br", 'fake brotli file')
|
||||
|
||||
get :brotli_asset, path: 'test.js'
|
||||
|
||||
expect(response.status).to eq(200)
|
||||
expect(response.headers["Cache-Control"]).to match(/public/)
|
||||
end
|
||||
end
|
||||
|
||||
context 'show' do
|
||||
before do
|
||||
post = create_post
|
||||
|
|
Loading…
Reference in New Issue