Buffet utilities updated for GCD device registration

Updated some utility functions to provid the functionality needed
for implementing GCD device registration services.

DataEncoding - typedefed key-value pairs as WebParamList to simplify
the usage of WebParamsEncode/WebParamsDecode functions

http::Request - Added a helper function to add a list of HTTP headers
to the request at once.

http::curl::Transport - added a lot of debug logging information to
help debugging HTTP communications between Buffet and external
servers. Also fixed sending data with custom request such as PATCH.
Finally, response headers used to include trailing new line chars.

http::TransportInterface - provided a typedef for the list of
HTTP request headers

http_utils - Switched from using char const* to std::string const&
in URLs for ease of use.
Added generic SendRequest().
Added the ability to add custom request headers when using PostXXX()
Added helper for sending PATCH request with JSON objects.
Changed ParseJsonResponse() to expect JSON object (dictionary)
instead of generic value as the server response. This simplifies the
common usage. Also enabled this function to parse error responses
as well.

BUG=chromium:363348
TEST=unit tests passed.

Change-Id: Ieb407731d6664feb0370bbaeeda16df8f6b7c5d1
Reviewed-on: https://chromium-review.googlesource.com/194856
Reviewed-by: Christopher Wiley <wiley@chromium.org>
Tested-by: Alex Vakulenko <avakulenko@chromium.org>
Commit-Queue: Alex Vakulenko <avakulenko@chromium.org>
9 files changed
tree: 4d3252292157e743237a9c0b9638ad6d4f74a282
  1. buffet/