font_assets 0.1.7 → 0.1.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/font_assets/middleware.rb +5 -1
- data/lib/font_assets/version.rb +1 -1
- data/spec/middleware_spec.rb +33 -1
- metadata +2 -2
@@ -36,7 +36,7 @@ module FontAssets
|
|
36
36
|
private
|
37
37
|
|
38
38
|
def origin
|
39
|
-
if allow_ssl? and ssl_request?
|
39
|
+
if !wildcard_origin? and allow_ssl? and ssl_request?
|
40
40
|
uri = URI(@origin)
|
41
41
|
uri.scheme = "https"
|
42
42
|
uri.to_s
|
@@ -45,6 +45,10 @@ module FontAssets
|
|
45
45
|
end
|
46
46
|
end
|
47
47
|
|
48
|
+
def wildcard_origin?
|
49
|
+
@origin == '*'
|
50
|
+
end
|
51
|
+
|
48
52
|
def ssl_request?
|
49
53
|
@ssl_request
|
50
54
|
end
|
data/lib/font_assets/version.rb
CHANGED
data/spec/middleware_spec.rb
CHANGED
@@ -39,7 +39,39 @@ describe FontAssets::Middleware do
|
|
39
39
|
its(['Content-Type']) { should == 'application/x-font-ttf' }
|
40
40
|
end
|
41
41
|
end
|
42
|
-
|
42
|
+
|
43
|
+
end
|
44
|
+
|
45
|
+
context 'with an app that allows ssl from any origin' do
|
46
|
+
let(:app) { load_app '*', allow_ssl: true }
|
47
|
+
|
48
|
+
context 'and makes an https request' do
|
49
|
+
let(:response) { request app, 'https://test.origin/test.ttf' }
|
50
|
+
|
51
|
+
context 'the response headers' do
|
52
|
+
subject { response[1] }
|
53
|
+
|
54
|
+
its(["Access-Control-Allow-Headers"]) { should == "x-requested-with" }
|
55
|
+
its(["Access-Control-Max-Age"]) { should == "3628800" }
|
56
|
+
its(['Access-Control-Allow-Methods']) { should == 'GET' }
|
57
|
+
its(['Access-Control-Allow-Origin']) { should == '*' }
|
58
|
+
its(['Content-Type']) { should == 'application/x-font-ttf' }
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
context 'and makes an http request' do
|
63
|
+
let(:response) { request app, 'http://test.origin/test.ttf' }
|
64
|
+
|
65
|
+
context 'the response headers' do
|
66
|
+
subject { response[1] }
|
67
|
+
|
68
|
+
its(["Access-Control-Allow-Headers"]) { should == "x-requested-with" }
|
69
|
+
its(["Access-Control-Max-Age"]) { should == "3628800" }
|
70
|
+
its(['Access-Control-Allow-Methods']) { should == 'GET' }
|
71
|
+
its(['Access-Control-Allow-Origin']) { should == '*' }
|
72
|
+
its(['Content-Type']) { should == 'application/x-font-ttf' }
|
73
|
+
end
|
74
|
+
end
|
43
75
|
end
|
44
76
|
|
45
77
|
context 'with an app with just the origin specified' do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: font_assets
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.8
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-05-
|
12
|
+
date: 2013-05-29 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rack
|