sinatra-cors 1.0.2 → 1.1.0
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.
- checksums.yaml +4 -4
- data/lib/sinatra/cors.rb +6 -6
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b4abf15998834b3658a83b182a1990ac6725a49c
|
4
|
+
data.tar.gz: 37d772351b207fd7eeae32c5b9b214d30eb0d57d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ef81f81eba3dd4a95e15104d8be02ab96da6737ac1bf7f61f828c318aa860765ed9909d54bd938999e2c365b508ecb49d1154b5e60026f0180b3a201022212da
|
7
|
+
data.tar.gz: 159ba3267236562a09ca848e66bd0eacbee6050ba9d2f25416941d2fe5a3a5c016331cd658d8772362ffa6b25dec1ee2c95c1f8fdad632eba08f555c82356d16
|
data/lib/sinatra/cors.rb
CHANGED
@@ -5,6 +5,11 @@ module Sinatra
|
|
5
5
|
module Helpers
|
6
6
|
def cors
|
7
7
|
if is_cors_request?
|
8
|
+
unless origin_is_allowed?
|
9
|
+
logger.warn bad_origin_message
|
10
|
+
return
|
11
|
+
end
|
12
|
+
|
8
13
|
if is_preflight_request?
|
9
14
|
unless method_is_allowed?
|
10
15
|
logger.warn bad_method_message
|
@@ -23,12 +28,7 @@ module Sinatra
|
|
23
28
|
response.headers["Access-Control-Expose-Headers"] = settings.expose_headers if settings.expose_headers?
|
24
29
|
end
|
25
30
|
|
26
|
-
|
27
|
-
response.headers["Access-Control-Allow-Origin"] = request.env["HTTP_ORIGIN"]
|
28
|
-
else
|
29
|
-
logger.warn bad_origin_message
|
30
|
-
response.headers["Access-Control-Allow-Origin"] = "null"
|
31
|
-
end
|
31
|
+
response.headers["Access-Control-Allow-Origin"] = request.env["HTTP_ORIGIN"]
|
32
32
|
response.headers["Access-Control-Allow-Credentials"] = settings.allow_credentials.to_s if settings.allow_credentials?
|
33
33
|
end
|
34
34
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sinatra-cors
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jason Desrosiers
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-10-
|
11
|
+
date: 2017-10-05 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: 'This Sinatra plugin supports the full CORS spec including automatic
|
14
14
|
support for CORS preflight (OPTIONS) requests. It uses CORS security best practices. The
|
@@ -42,7 +42,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
42
42
|
version: '0'
|
43
43
|
requirements: []
|
44
44
|
rubyforge_project:
|
45
|
-
rubygems_version: 2.6.
|
45
|
+
rubygems_version: 2.6.13
|
46
46
|
signing_key:
|
47
47
|
specification_version: 4
|
48
48
|
summary: CORS support for Sinatra applications
|