sinatra-rest-helpers 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/sinatra/rest_helpers.rb +1 -1
- data/sinatra-rest-helpers.gemspec +2 -2
- data/spec/sinatra-rest-helpers_spec.rb +7 -0
- metadata +2 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.3.0
|
data/lib/sinatra/rest_helpers.rb
CHANGED
@@ -23,7 +23,7 @@ module Sinatra
|
|
23
23
|
end
|
24
24
|
selected_format = supported_formats.detect{ |supported_format|
|
25
25
|
!accepted_formats.detect{ |accepted_format|
|
26
|
-
Regexp.new(Regexp.escape(accepted_format["type"]).gsub("\\*", ".*?")) =~ supported_format["type"] &&
|
26
|
+
Regexp.new(Regexp.escape(accepted_format["type"]).gsub("\\*", ".*?"), Regexp::IGNORECASE) =~ supported_format["type"] &&
|
27
27
|
(accepted_format["level"] || INFINITY).to_f >= (supported_format["level"] || 0).to_f
|
28
28
|
}.nil?
|
29
29
|
}
|
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{sinatra-rest-helpers}
|
8
|
-
s.version = "0.
|
8
|
+
s.version = "0.3.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Cyril Rohr"]
|
12
|
-
s.date = %q{2009-10-
|
12
|
+
s.date = %q{2009-10-20}
|
13
13
|
s.description = %q{A set of helpers for sinatra apps that expose REST resources.}
|
14
14
|
s.email = %q{cyril.rohr@gmail.com}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -38,6 +38,13 @@ describe "SinatraRestHelpers" do
|
|
38
38
|
app.test_provides!(:json)
|
39
39
|
app.response.headers['Content-Type'].should == "application/json"
|
40
40
|
end
|
41
|
+
it "should be case insensitive" do
|
42
|
+
request = mock("request", :accept => "application/json")
|
43
|
+
app = App.new(request)
|
44
|
+
app.should_not_receive(:halt)
|
45
|
+
app.test_provides!("application/JSON")
|
46
|
+
app.response.headers['Content-Type'].should == "application/JSON"
|
47
|
+
end
|
41
48
|
it "should not accept a request with a type level lower than what is supported" do
|
42
49
|
request = mock("request", :accept => "application/json;level=1")
|
43
50
|
app = App.new(request)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sinatra-rest-helpers
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
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-10-
|
12
|
+
date: 2009-10-20 00:00:00 +02:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|