Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only intercept preflight requests for fonts, and bonus insert_target configuration option #18

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

snikch
Copy link

@snikch snikch commented Nov 20, 2013

Sorry this is a two in one

  • Preflight requests are only intercepted for font assets. Makes the gem compatible with Rack::Cors or any other setup that also requires special preflight responses
  • Added an insert_target option so that you can choose which middleware you want font_assets to be inserted before

@xevix
Copy link

xevix commented Feb 25, 2014

+1

@ericallam
Copy link
Owner

Could you expand this PR to include some specs to demonstrate the features working? To run the specs all you have to do is bundle install and then bundle exec rspec spec

@sandeep45
Copy link

+1 Could use some merging

@ericallam
Copy link
Owner

Still looking for specs to prove this works before merging.

@@ -8,13 +8,16 @@ class Railtie < Rails::Railtie
config.font_assets.origin ||= "*"
config.font_assets.options ||= { allow_ssl: true }

insert_target = if defined?(ActionDispatch::Static)
config.font_assets.insert_target ||= if defined?(ActionDispatch::Static)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

defined?(ActionDispatch::Static) never returns false, even if serve_static_assets is false. This should probably check for its presence in app.middleware instead.

@dmur
Copy link

dmur commented Jul 16, 2014

+1, please merge -- this gem's current behavior of responding to any preflight request is really confusing.

@ericallam
Copy link
Owner

@dmur and @sandeep45, I can't merge this PR until there are specs proving this functionality works. It would be irresponsible of me to just merge in some code that is untested.

@dmur
Copy link

dmur commented Jul 22, 2014

@ericallam Understood. I'm not a rails guy by trade or I'd write the specs myself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants