We got nominated! Help us out and vote for GitHub as Best Bootstrapped Startup of 2008. (You can vote once a day.) [ hide ]

public
Rubygem
Description: Resource-oriented open source Ruby framework for Web apps.
Homepage: http://rubywaves.com/
Clone URL: git://github.com/dyoder/waves.git
accept method for request
automatthew (author)
Mon Jul 21 19:22:56 -0700 2008
commit  d2c44e665cfc56790225efb870ce50c54d4a8a9e
tree    8cd27889045c050b6e8bebb63354a646315b7e07
parent  00ec93f270be32960b2c508c6aa22bd77ac04924
...
39
40
41
 
 
 
 
42
43
44
...
39
40
41
42
43
44
45
46
47
48
0
@@ -39,6 +39,10 @@ module Waves
0
     def content_type
0
       @request.env['CONTENT_TYPE']
0
     end
0
+
0
+ def accept
0
+ @request.env['HTTP_ACCEPT'].split(',').map { |entry| entry.split( ';' ).first }
0
+ end
0
 
0
     # Request method predicates, defined in terms of #method.
0
     METHODS = %w{get post put delete head options trace}
...
5
6
7
8
 
9
10
11
...
29
30
31
 
 
 
 
 
32
33
34
...
5
6
7
 
8
9
10
11
...
29
30
31
32
33
34
35
36
37
38
39
0
@@ -5,7 +5,7 @@ describe "A Waves request instance" do
0
   
0
   before do
0
     Waves::Session.stub!(:base_path).and_return(BasePath)
0
- @request = Waves::Request.new(env_for)
0
+ @request = Waves::Request.new(env_for("/", 'HTTP_ACCEPT' => 'text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5'))
0
   end
0
   
0
   it "has session, response, and blackboard objects" do
0
@@ -29,6 +29,11 @@ describe "A Waves request instance" do
0
     @request.content_type
0
   end
0
   
0
+ it "parses the Accept header for content-types" do
0
+ entries = ["text/xml", "application/xml", "application/xhtml+xml", "text/html", "text/plain", "image/png", "*/*"]
0
+ @request.accept.should == entries
0
+ end
0
+
0
   # ** API CHANGE **
0
   # it "delegates unknown methods to the Rack request" do
0
   # @request.rack_request.should.receive(:chitty_bang_bang)

Comments

    No one has commented yet.