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
|
raise Discourse::NotFound
|
||||||
end
|
end
|
||||||
|
|
||||||
|
expires_in 1.year, public: true, must_revalidate: false
|
||||||
|
|
||||||
if File.exists?(path)
|
if File.exists?(path)
|
||||||
send_file(path, opts)
|
send_file(path, opts)
|
||||||
else
|
else
|
||||||
|
|
|
@ -2,6 +2,18 @@ require 'rails_helper'
|
||||||
|
|
||||||
describe StaticController do
|
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
|
context 'show' do
|
||||||
before do
|
before do
|
||||||
post = create_post
|
post = create_post
|
||||||
|
|
Loading…
Reference in New Issue