Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

fixes issue #13

  • Loading branch information...
commit 4317a52e386571804a8dbd32f6fea1e3329eb45d 1 parent b76dfe0
Kellen Presley authored
View
2  picard/lib/picard/request_extensions.js
@@ -43,7 +43,7 @@ var request_extensions = {
scope.headers.push([ 'Content-Type', scope.type || 'text/html' ])
scope.headers = locals._set_cookies.call(req, scope.headers)
- if ( scope.status == 500 )
+ if ( scope.status == 500 && !scope.template )
req.send_data(scope)
else
locals._build_document.call(req, scope)
View
8 sample_app/app.js
@@ -169,6 +169,14 @@ get('/foo/bar/*:baz', function(params) {
return {text: "Globbed params for 'baz': " + params.baz}
})
+get('/status/500', function(env){
+ env.on_screen({ // render a template
+ status: 500,
+ template: 'advanced',
+ commands: commands
+ })
+})
+
// controllers are groups of routes nested under a "route_set"
require('./controllers/ops_controller')
require('./controllers/test_controller')
View
6 sample_app/spec/app_spec.rb
@@ -297,4 +297,10 @@
res = Curl::Easy.perform(base_url + '/anonymous_fail_route')
res.body_str.should include("foo is not defined")
end
+
+ it 'should allow template rendering if the status is 500' do
+ res = Curl::Easy.perform(base_url + '/status/500')
+ res.body_str.should include('is even')
+ res.header_str.should include('500')
+ end
end
Please sign in to comment.
Something went wrong with that request. Please try again.