herbert 0.0.6 → 0.0.7

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.
@@ -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 addition headers loaded")
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
- # Proxy for not CORS enables services such as
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
- url = URI.parse(URI.encode(params[:url]))
53
- res = Net::HTTP.start(url.host, 80) {|http|
54
- http.get(url.path + '?' + url.query)
55
- }
56
- response['content-type'] = res['content-type']
57
- res.body
58
- end
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
- end
68
+ end
61
69
  end
@@ -1,3 +1,3 @@
1
1
  module Herbert
2
- VERSION = "0.0.6"
2
+ VERSION = "0.0.7"
3
3
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 0
8
- - 6
9
- version: 0.0.6
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-03 00:00:00 +02:00
17
+ date: 2011-08-17 00:00:00 +02:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency