summaryrefslogtreecommitdiffstats
path: root/lib/puppet/network/http/webrick
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/webrick
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/webrick')
-rw-r--r--lib/puppet/network/http/webrick/rest.rb10
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/puppet/network/http/webrick/rest.rb b/lib/puppet/network/http/webrick/rest.rb
index c7cc06916..13f795fb2 100644
--- a/lib/puppet/network/http/webrick/rest.rb
+++ b/lib/puppet/network/http/webrick/rest.rb
@@ -22,7 +22,7 @@ class Puppet::Network::HTTP::WEBrickREST < WEBrick::HTTPServlet::AbstractServlet
end
def accept_header(request)
- request[:accept]
+ request["accept"]
end
def http_method(request)
@@ -45,12 +45,16 @@ class Puppet::Network::HTTP::WEBrickREST < WEBrick::HTTPServlet::AbstractServlet
# Set the specified format as the content type of the response.
def set_content_type(response, format)
- response[:content_type] = format
+ response["content-type"] = format
end
def set_response(response, result, status = 200)
response.status = status
- response.body = result
+ if status >= 200 and status < 300
+ response.body = result
+ else
+ response.reason_phrase = result
+ end
end
# Retrieve node/cert/ip information from the request object.