diff options
author | Nick Lewis <nick@puppetlabs.com> | 2011-04-12 17:08:36 -0700 |
---|---|---|
committer | Nick Lewis <nick@puppetlabs.com> | 2011-04-12 17:08:36 -0700 |
commit | 46721411066926aff3a7d5bb6470d3b8aec1b47d (patch) | |
tree | 5f844a68b7fe541b3699762b635cf1d8c40312f5 /lib/puppet/network | |
parent | 8778307ca33a637fe10b601ee737628f2e5f9fbf (diff) | |
download | puppet-46721411066926aff3a7d5bb6470d3b8aec1b47d.tar.gz puppet-46721411066926aff3a7d5bb6470d3b8aec1b47d.tar.xz puppet-46721411066926aff3a7d5bb6470d3b8aec1b47d.zip |
(#6117) Add POST support to indirector requests
POST with a singular indirection is turned into a find in the indirector.
When making a large find request from a REST terminus, POST is used, and for
small requests, GET is used for backward compatibility.
Paired-With: Jesse Wolfe
Diffstat (limited to 'lib/puppet/network')
-rw-r--r-- | lib/puppet/network/http/api/v1.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/puppet/network/http/api/v1.rb b/lib/puppet/network/http/api/v1.rb index 5fe143979..61307f01e 100644 --- a/lib/puppet/network/http/api/v1.rb +++ b/lib/puppet/network/http/api/v1.rb @@ -8,6 +8,9 @@ module Puppet::Network::HTTP::API::V1 :plural => :search, :singular => :find }, + "POST" => { + :singular => :find, + }, "PUT" => { :singular => :save }, @@ -41,6 +44,11 @@ module Puppet::Network::HTTP::API::V1 "/#{request.environment.to_s}/#{indirection}/#{request.escaped_key}#{request.query_string}" end + def request_to_uri_and_body(request) + indirection = request.method == :search ? pluralize(request.indirection_name.to_s) : request.indirection_name.to_s + ["/#{request.environment.to_s}/#{indirection}/#{request.escaped_key}", request.query_string.sub(/^\?/,'')] + end + def indirection_method(http_method, indirection) raise ArgumentError, "No support for http method #{http_method}" unless METHOD_MAP[http_method] |