[chef] Re: Re: Posting JSON with http_request


Chronological Thread 
  • From: Nathan Mische < >
  • To:
  • Subject: [chef] Re: Re: Posting JSON with http_request
  • Date: Wed, 19 Mar 2014 22:05:11 -0400

Thanks Daniel. Converting the documentation sample to the following works:

http_request "posting data" do
  action :post
  url "http://example.com/check_in"
  message ({:some => "data"}.to_json)
  headers({"AUTHORIZATION" => "Basic #{Base64.encode64("username:password")}","Content-Type" => "application/data"})
end

Do you know, has the behavior of http_request changed and the documentation (http://docs.opscode.com/resource_http_request.html#examples) not been updated? Or is this a regression?

Thanks Again,

-Nathan



On Wed, Mar 19, 2014 at 11:44 AM, Daniel DeLeo < " target="_blank"> > wrote:


On Friday, March 14, 2014 at 7:25 AM, Nathan Mische wrote:

> Hello,
>
> It looks like posting JSON with http_request broke in Chef 11.8. (See: https://tickets.opscode.com/browse/CHEF-4877) Does anyone know of a workaround?
>
> Thanks,
>
> -Nathan
Convert the body to a JSON string with {“thing” => “value”}.to_json, and add the correct content-type header.

--
Daniel DeLeo







Archive powered by MHonArc 2.6.16.

§