moonrope 1.2.3 → 1.2.4
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/moonrope/rack_middleware.rb +24 -4
- data/lib/moonrope/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 7a005ba55f00db5d481ac58a7160e591e993c39b
|
|
4
|
+
data.tar.gz: 0189df9139aa0bf21c6a991592632478a2dbd769
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f6d0eb2be42d7b122abf4abc8bfbe7575523511bef0215c669f4455e44768273cc4744fddc5da475f521307e516e684e42ddab466b20014faa0d62bdd5a978ab
|
|
7
|
+
data.tar.gz: aa90abdd05744a1fd171a53f278d4b35bc5cdcbf647bfa343933538b7e2c4223617ad511a4bfbdcc5aa3aeb0ebc7a4a4da14be26f619b90317abb6e27a649557
|
|
@@ -33,15 +33,35 @@ module Moonrope
|
|
|
33
33
|
#
|
|
34
34
|
request = @base.request(env, $1)
|
|
35
35
|
|
|
36
|
+
#
|
|
37
|
+
# Set some global headers which are always returned
|
|
38
|
+
#
|
|
39
|
+
global_headers = {}
|
|
40
|
+
global_headers['Content-Type'] = 'text/plain'
|
|
41
|
+
global_headers['Access-Control-Allow-Origin'] = '*'
|
|
42
|
+
if env['HTTP_ACCESS_CONTROL_REQUEST_HEADERS']
|
|
43
|
+
global_headers['Access-Control-Allow-Headers'] = env['HTTP_ACCESS_CONTROL_REQUEST_HEADERS']
|
|
44
|
+
end
|
|
45
|
+
global_headers['Access-Control-Allow-Methods'] = '*'
|
|
46
|
+
|
|
47
|
+
#
|
|
48
|
+
# Options always returns a 200
|
|
49
|
+
#
|
|
50
|
+
if env['REQUEST_METHOD'] == 'OPTIONS'
|
|
51
|
+
return [200, global_headers, ['OK']]
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
#
|
|
55
|
+
# Responses are now in JSON
|
|
56
|
+
#
|
|
57
|
+
global_headers['Content-Type'] = 'application/json'
|
|
58
|
+
|
|
36
59
|
#
|
|
37
60
|
# Check the request is valid
|
|
38
61
|
#
|
|
39
62
|
unless request.valid?
|
|
40
|
-
return [400,
|
|
63
|
+
return [400, global_headers, [{:status => 'invalid-controller-or-action'}.to_json]]
|
|
41
64
|
end
|
|
42
|
-
|
|
43
|
-
global_headers = {}
|
|
44
|
-
global_headers['Content-Type'] = 'application/json'
|
|
45
65
|
|
|
46
66
|
#
|
|
47
67
|
# Execute the request
|
data/lib/moonrope/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: moonrope
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.2.
|
|
4
|
+
version: 1.2.4
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Adam Cooke
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2014-07-
|
|
11
|
+
date: 2014-07-25 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: json
|