herbert 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/herbert/Ajaxify.rb +19 -11
- data/lib/herbert/version.rb +1 -1
- metadata +3 -3
data/lib/herbert/Ajaxify.rb
CHANGED
@@ -31,7 +31,7 @@ module Herbert
|
|
31
31
|
Headers[name] = (Headers[name] || []) | value
|
32
32
|
}
|
33
33
|
else
|
34
|
-
log.h_info("File #{path} doesn't exists; no
|
34
|
+
log.h_info("File #{path} doesn't exists; no additional headers loaded")
|
35
35
|
end
|
36
36
|
|
37
37
|
app.before do
|
@@ -44,18 +44,26 @@ module Herbert
|
|
44
44
|
response[name] = value.join(', ')
|
45
45
|
}
|
46
46
|
end
|
47
|
-
|
48
|
-
#
|
47
|
+
|
48
|
+
# enable OPTIONS verb
|
49
|
+
class << Sinatra::Base
|
50
|
+
def http_options path, opts={}, &block
|
51
|
+
route 'OPTIONS', path, opts, &block
|
52
|
+
end
|
53
|
+
end
|
54
|
+
Sinatra::Delegator.delegate :http_options
|
55
|
+
|
56
|
+
# Proxy for not CORS enabled services such as
|
49
57
|
# Google Maps
|
50
58
|
# /proxy/url?=
|
51
59
|
app.get '/proxy/' do
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
60
|
+
url = URI.parse(URI.encode(params[:url]))
|
61
|
+
res = Net::HTTP.start(url.host, 80) {|http|
|
62
|
+
http.get(url.path + '?' + url.query)
|
63
|
+
}
|
64
|
+
response['content-type'] = res['content-type']
|
65
|
+
res.body
|
66
|
+
end
|
59
67
|
end
|
60
|
-
|
68
|
+
end
|
61
69
|
end
|
data/lib/herbert/version.rb
CHANGED
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: 0.0.
|
8
|
+
- 7
|
9
|
+
version: 0.0.7
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Pavel Kalvoda
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2011-08-
|
17
|
+
date: 2011-08-17 00:00:00 +02:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|