summaryrefslogtreecommitdiffstats
path: root/lib/puppet/indirector
diff options
context:
space:
mode:
authorLuke Kanies <luke@madstop.com>2008-07-21 17:19:17 -0500
committerLuke Kanies <luke@madstop.com>2008-07-29 00:47:02 -0500
commitbf5b086ca7fb89f941873e95feae2fc2b259037a (patch)
tree7f340bf518148e6a528d5ff13f8d0103e47fc549 /lib/puppet/indirector
parent1f15725263812be347c42a2ea3777fee7b2129c9 (diff)
downloadpuppet-bf5b086ca7fb89f941873e95feae2fc2b259037a.tar.gz
puppet-bf5b086ca7fb89f941873e95feae2fc2b259037a.tar.xz
puppet-bf5b086ca7fb89f941873e95feae2fc2b259037a.zip
The REST terminus now provides an Accept header with supported formats.
Signed-off-by: Luke Kanies <luke@madstop.com>
Diffstat (limited to 'lib/puppet/indirector')
-rw-r--r--lib/puppet/indirector/rest.rb11
1 files changed, 8 insertions, 3 deletions
diff --git a/lib/puppet/indirector/rest.rb b/lib/puppet/indirector/rest.rb
index 77dd0538b..6dbdada4d 100644
--- a/lib/puppet/indirector/rest.rb
+++ b/lib/puppet/indirector/rest.rb
@@ -3,20 +3,25 @@ require 'uri'
# Access objects via REST
class Puppet::Indirector::REST < Puppet::Indirector::Terminus
+ # Provide appropriate headers.
+ def headers
+ {"Accept" => model.supported_formats.join(", ")}
+ end
+
def rest_connection_details
{ :host => Puppet[:server], :port => Puppet[:masterport].to_i }
end
def network_fetch(path)
- network.get("/#{path}").body
+ network.get("/#{path}", headers).body
end
def network_delete(path)
- network.delete("/#{path}").body
+ network.delete("/#{path}", headers).body
end
def network_put(path, data)
- network.put("/#{path}", data).body
+ network.put("/#{path}", data, headers).body
end
def find(request)