mirror of
https://github.com/discourse/discourse.git
synced 2025-05-22 18:11:11 +08:00
DEV: enable cors to all cdn get requests from workbox. (#10685)
Now all external requests from the service worker will be in CORS mode without credentials.
This commit is contained in:
@ -116,6 +116,25 @@ describe StaticController do
|
||||
File.delete(file_path)
|
||||
end
|
||||
end
|
||||
|
||||
it 'has correct cors headers for brotli assets' do
|
||||
begin
|
||||
assets_path = Rails.root.join("public/assets")
|
||||
|
||||
FileUtils.mkdir_p(assets_path)
|
||||
|
||||
file_path = assets_path.join("test.js.br")
|
||||
File.write(file_path, 'fake brotli file')
|
||||
GlobalSetting.stubs(:cdn_url).returns("https://www.example.com/")
|
||||
|
||||
get "/brotli_asset/test.js"
|
||||
|
||||
expect(response.status).to eq(200)
|
||||
expect(response.headers["Access-Control-Allow-Origin"]).to match("*")
|
||||
ensure
|
||||
File.delete(file_path)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context '#cdn_asset' do
|
||||
|
Reference in New Issue
Block a user