Hi all,

This may well be something I'm doing incorrectly (in fact I hope it is). I am trying to send a HTTP POST request to a local server (running Ruby on Rails under puma.) The code below is almost verbatim from the online sample:

auto response = requestHTTP("http://localhost:3000/users/login",
		(scope req) {
			req.method = HTTPMethod.POST;
			req.headers["Accept"] = "application/json";
			auto data = ["user_email": username, "user_password": password];
			req.writeJsonBody(data);
		}
	);

However, although it hits the correct endpoint/route on the Rails server, the data I am posting is not making it through. I have posted the full output of the Rails server below.

Started POST "/users/login" for 127.0.0.1 at 2014-08-14 15:45:54 +1000
Processing by SessionsController#create as JSON
  Parameters: {"session"=>{}}
Completed 401 Unauthorized in 1ms
2014-08-14 15:45:54 +1000: HTTP parse error, malformed request (): #<Puma::HttpParserError: Invalid HTTP format, parsing fails.>
2014-08-14 15:45:54 +1000: ENV: {"rack.version"=>[1, 2], "rack.errors"=>#<IO:<STDERR>>, "rack.multithread"=>true, "rack.multiprocess"=>false, "rack.run_once"=>false, "SCRIPT_NAME"=>"", "CONTENT_TYPE"=>"text/plain", "QUERY_STRING"=>"", "SERVER_PROTOCOL"=>"HTTP/1.1", "SERVER_SOFTWARE"=>"2.8.2", "GATEWAY_INTERFACE"=>"CGI/1.2"}

If anybody could help me out with this one, albeit with the limited debug info, I'd be eternally grateful.

Regards,

David.