cryx-g5k 0.2.5 → 0.2.6
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION.yml +1 -1
- data/lib/g5k/rack/accept_format.rb +1 -1
- data/spec/sinatra_helpers_spec.rb +2 -4
- metadata +2 -2
data/VERSION.yml
CHANGED
@@ -33,7 +33,7 @@ module Rack
|
|
33
33
|
|
34
34
|
def call(env)
|
35
35
|
req = Rack::Request.new(env)
|
36
|
-
|
36
|
+
if ::File.extname(req.path_info).empty?
|
37
37
|
accept = env['HTTP_ACCEPT'].scan(/[^;,\s]*\/[^;,\s]*/)[0] rescue ""
|
38
38
|
extension = Rack::Mime::MIME_TYPES.invert[accept] || DEFAULT_EXTENSION
|
39
39
|
req.path_info = req.path_info+"#{extension}"
|
@@ -27,16 +27,14 @@ describe G5K::Sinatra::Helpers do
|
|
27
27
|
options = {:code => 500, :message => "message", :title => "title"}
|
28
28
|
req = Request.new
|
29
29
|
req.should_receive(:content_type).with(:json, :charset => 'utf-8')
|
30
|
-
req.
|
31
|
-
req.formatted_error(404, options.merge({:parser => JSON, :format => 'json'}))
|
30
|
+
req.formatted_error(404, options.merge({:parser => JSON, :format => 'json'})).should == [404, options.to_json]
|
32
31
|
end
|
33
32
|
|
34
33
|
it "should format the error even when no parser is given" do
|
35
34
|
options = {:code => 500, :message => "message", :title => "title"}
|
36
35
|
req = Request.new
|
37
36
|
req.should_receive(:content_type).with(:txt, :charset => 'utf-8')
|
38
|
-
req.
|
39
|
-
req.formatted_error(404, options)
|
37
|
+
req.formatted_error(404, options).should == [404, "code=500;message=message;title=title"]
|
40
38
|
end
|
41
39
|
|
42
40
|
it "should log the error if a logger is defined in the Sinatra options" do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cryx-g5k
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Cyril Rohr
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-03-
|
12
|
+
date: 2009-03-18 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|