GitHub Sale: sign up for any paid plan this week and pay nothing until January 1, 2009!  [ 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
better simple 404 error
automatthew (author)
Fri May 09 14:33:11 -0700 2008
commit  01f6bfa644d1d59a5d0726edd6a2a2a583ff82d2
tree    dc10c039a9c91b31f4d5806f6af440d6725c9024
parent  2630c92ef472fbd90ad7399d015ba36ccaa3c53f
...
7
8
9
10
 
11
12
13
...
7
8
9
 
10
11
12
13
0
@@ -7,7 +7,7 @@ module Waves
0
         app.instance_eval do
0
 
0
           autoinit 'Configurations::Mapping' do
0
- handle(Waves::Dispatchers::NotFoundError) { response.status = 404 }
0
+ handle(Waves::Dispatchers::NotFoundError) { response.status = 404; response.body = "404 Not Found" }
0
           end
0
 
0
         end
...
10
11
12
13
 
14
15
16
17
18
19
20
21
 
 
 
 
 
 
22
23
...
10
11
12
 
13
14
15
 
 
 
 
 
 
16
17
18
19
20
21
22
23
0
@@ -10,14 +10,14 @@ specification "A developer can register exception handlers" do
0
   specify 'The minimal 404 handler in SimpleErrors' do
0
     r = get('/')
0
     r.status.should == 404
0
- r.body.should.be.empty
0
+ r.body.should == '404 Not Found'
0
   end
0
 
0
- # specify "A custom 404 handler should override the minimal" do
0
- # handle(Waves::Dispatchers::NotFoundError) { response.status = 404; response.body = "gone baby gone"}
0
- # r = get('/')
0
- # r.status.should == 404
0
- # r.body.should == "gone baby gone"
0
- # end
0
+ specify "A custom 404 handler should override the minimal" do
0
+ handle(Waves::Dispatchers::NotFoundError) { response.status = 404; response.body = "gone baby gone"}
0
+ r = get('/')
0
+ r.status.should == 404
0
+ r.body.should == "gone baby gone"
0
+ end
0
 
0
 end

Comments

    No one has commented yet.