summaryrefslogtreecommitdiffstats
path: root/lib/puppet/network/http/mongrel
diff options
context:
space:
mode:
authorLuke Kanies <luke@madstop.com>2008-07-28 11:23:08 -0500
committerLuke Kanies <luke@madstop.com>2008-07-29 00:51:22 -0500
commit4632cfd9e6ce0ff59dfa7562a02a1ae3f14488d4 (patch)
tree50f6c0ef591867bafe4ac9ea3c3f64d045bec573 /lib/puppet/network/http/mongrel
parente3350caeec3a662b0b92ec2dee372563a493fa11 (diff)
downloadpuppet-4632cfd9e6ce0ff59dfa7562a02a1ae3f14488d4.tar.gz
puppet-4632cfd9e6ce0ff59dfa7562a02a1ae3f14488d4.tar.xz
puppet-4632cfd9e6ce0ff59dfa7562a02a1ae3f14488d4.zip
All error and format handling works over REST except searching.
Searching operates on multiple instances, and I have not yet figured out how we should handle converting multiple instances to a given format -- we can't use the instance method (e.g., to_yaml), because it would be on Array instead of the class we're operating on. That would work for yaml, but not, for instance, for xml.
Diffstat (limited to 'lib/puppet/network/http/mongrel')
-rw-r--r--lib/puppet/network/http/mongrel/rest.rb10
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/puppet/network/http/mongrel/rest.rb b/lib/puppet/network/http/mongrel/rest.rb
index d6c2e4679..d265dde86 100644
--- a/lib/puppet/network/http/mongrel/rest.rb
+++ b/lib/puppet/network/http/mongrel/rest.rb
@@ -49,7 +49,15 @@ class Puppet::Network::HTTP::MongrelREST < Mongrel::HttpHandler
# produce the body of the response
def set_response(response, result, status = 200)
- response.start(status) do |head, body|
+ args = [status]
+
+ # Set the 'reason' (or 'message', as it's called in Webrick), when
+ # we have a failure.
+ if status >= 300
+ args << false << result
+ end
+
+ response.start(*args) do |head, body|
body.write(result)
end
end