puppetlabs/puppetdb — pull request #880 by kbarber (2014-03-07 07:35:58+00:00)
Title: PDB-473 Support POST using application/json data in the body

This patch adds to the commands end-point the ability to simply POST using
application/json with the JSON content in the body.

It also switches the terminus to use this mechanism.

We found that the url encode/decode required to support x-www-form-urlencoded
was actually quite an overhead in a number of ways:

* The urlencode on the terminus added overhead
* The urldecode in the server added overhead
* The interim strings created during this encode/decode process can get quite
large increasing the amount of garbage collection required

This feature has been implemented by providing a new middleware that will move
the body into the param "payload" when the content-type is set to
application/json. This provides a convenient backwards compatible layer so that
the old form url encoding can still be supported.

Signed-off-by: Ken Barber