manifold 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +3 -0
- data/README.md +10 -2
- data/lib/manifold.rb +2 -4
- data/lib/manifold/version.rb +1 -1
- data/manifold.gemspec +1 -1
- data/test/mainfold_test.rb +10 -10
- metadata +28 -12
data/.travis.yml
ADDED
data/README.md
CHANGED
@@ -1,6 +1,14 @@
|
|
1
|
-
# Manifold
|
1
|
+
# Manifold: Cross Origin Resource Sharing for Public API's
|
2
2
|
|
3
|
-
|
3
|
+
[![Build Status](https://secure.travis-ci.org/twinturbo/manifold.png?branch=master)][travis]
|
4
|
+
[![Gem Version](https://badge.fury.io/rb/manifold.png)][gem]
|
5
|
+
[![Code Climate](https://codeclimate.com/github/twinturbo/manifold.png)][codeclimate]
|
6
|
+
[![Dependency Status](https://gemnasium.com/twinturbo/manifold.png?travis)][gemnasium]
|
7
|
+
|
8
|
+
[gem]: https://rubygems.org/gems/manifold
|
9
|
+
[travis]: http://travis-ci.org/twinturbo/manifold
|
10
|
+
[gemnasium]: https://gemnasium.com/twinturbo/manifold
|
11
|
+
[codeclimate]: https://codeclimate.com/github/twinturbo/manifold
|
4
12
|
|
5
13
|
Use this if you don't care about CORS problems and never want to see
|
6
14
|
them again.
|
data/lib/manifold.rb
CHANGED
@@ -33,6 +33,8 @@ module Manifold
|
|
33
33
|
|
34
34
|
headers['Access-Control-Allow-Origin'] = "*"
|
35
35
|
|
36
|
+
headers['Access-Control-Expose-Headers'] = Manifold.config.expose.join(', ') if Manifold.config.expose
|
37
|
+
|
36
38
|
[status, headers, body]
|
37
39
|
end
|
38
40
|
end
|
@@ -50,10 +52,6 @@ module Manifold
|
|
50
52
|
'Authorization'
|
51
53
|
].compact.join(', ')
|
52
54
|
|
53
|
-
if Manifold.config.expose
|
54
|
-
headers['Access-Control-Expose-Headers'] = Manifold.config.expose.join(', ')
|
55
|
-
end
|
56
|
-
|
57
55
|
headers['Access-Control-Allow-Credentials'] = "true"
|
58
56
|
|
59
57
|
headers['Access-Control-Max-Age'] = "1728000"
|
data/lib/manifold/version.rb
CHANGED
data/manifold.gemspec
CHANGED
@@ -16,6 +16,6 @@ Gem::Specification.new do |gem|
|
|
16
16
|
gem.version = Manifold::VERSION
|
17
17
|
|
18
18
|
gem.add_development_dependency "rack-test"
|
19
|
-
gem.add_development_dependency "rails"
|
19
|
+
gem.add_development_dependency "rails", '>= 3.0.0'
|
20
20
|
gem.add_development_dependency "simplecov"
|
21
21
|
end
|
data/test/mainfold_test.rb
CHANGED
@@ -70,16 +70,6 @@ class ManifoldTest < MiniTest::Unit::TestCase
|
|
70
70
|
assert_equal 'text/plain', last_response.content_type
|
71
71
|
end
|
72
72
|
|
73
|
-
def test_allows_for_custom_headers_exposed
|
74
|
-
Manifold.config.expose = ["X-Request-ID"]
|
75
|
-
|
76
|
-
preflight "PATCH"
|
77
|
-
|
78
|
-
assert last_response.ok?
|
79
|
-
headers = last_response.headers
|
80
|
-
assert_equal "X-Request-ID", headers['Access-Control-Expose-Headers']
|
81
|
-
end
|
82
|
-
|
83
73
|
def tests_allow_for_custom_headers_accept
|
84
74
|
Manifold.config.accept = ["X-Rate-Limit"]
|
85
75
|
|
@@ -98,6 +88,16 @@ class ManifoldTest < MiniTest::Unit::TestCase
|
|
98
88
|
assert headers['Access-Control-Max-Age']
|
99
89
|
end
|
100
90
|
|
91
|
+
def test_allows_for_custom_headers_exposed
|
92
|
+
Manifold.config.expose = ["X-Request-ID"]
|
93
|
+
|
94
|
+
get "/"
|
95
|
+
|
96
|
+
assert last_response.ok?
|
97
|
+
headers = last_response.headers
|
98
|
+
assert_equal "X-Request-ID", headers['Access-Control-Expose-Headers']
|
99
|
+
end
|
100
|
+
|
101
101
|
def test_adds_cors_support_for_simple_requests
|
102
102
|
get '/'
|
103
103
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: manifold
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2013-02-26 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rack-test
|
16
|
-
requirement:
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,21 +21,31 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements:
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0'
|
25
30
|
- !ruby/object:Gem::Dependency
|
26
31
|
name: rails
|
27
|
-
requirement:
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
28
33
|
none: false
|
29
34
|
requirements:
|
30
35
|
- - ! '>='
|
31
36
|
- !ruby/object:Gem::Version
|
32
|
-
version:
|
37
|
+
version: 3.0.0
|
33
38
|
type: :development
|
34
39
|
prerelease: false
|
35
|
-
version_requirements:
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: 3.0.0
|
36
46
|
- !ruby/object:Gem::Dependency
|
37
47
|
name: simplecov
|
38
|
-
requirement:
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
39
49
|
none: false
|
40
50
|
requirements:
|
41
51
|
- - ! '>='
|
@@ -43,7 +53,12 @@ dependencies:
|
|
43
53
|
version: '0'
|
44
54
|
type: :development
|
45
55
|
prerelease: false
|
46
|
-
version_requirements:
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
47
62
|
description: Rack middleware to enabled CORS
|
48
63
|
email:
|
49
64
|
- me@broadcastingadam.com
|
@@ -52,6 +67,7 @@ extensions: []
|
|
52
67
|
extra_rdoc_files: []
|
53
68
|
files:
|
54
69
|
- .gitignore
|
70
|
+
- .travis.yml
|
55
71
|
- Gemfile
|
56
72
|
- LICENSE
|
57
73
|
- README.md
|
@@ -77,7 +93,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
77
93
|
version: '0'
|
78
94
|
segments:
|
79
95
|
- 0
|
80
|
-
hash:
|
96
|
+
hash: -560821971248689139
|
81
97
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
82
98
|
none: false
|
83
99
|
requirements:
|
@@ -86,10 +102,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
86
102
|
version: '0'
|
87
103
|
segments:
|
88
104
|
- 0
|
89
|
-
hash:
|
105
|
+
hash: -560821971248689139
|
90
106
|
requirements: []
|
91
107
|
rubyforge_project:
|
92
|
-
rubygems_version: 1.8.
|
108
|
+
rubygems_version: 1.8.25
|
93
109
|
signing_key:
|
94
110
|
specification_version: 3
|
95
111
|
summary: ''
|