Arduino HTTP Post request I have a Arduino Mega with Wiznet 5100 Ethernet shield. Am trying to post some data onto localhost for started later on which will be accepted by a website. 
But when I try to post the data I get some error. When I try to send the same data via postman it gets accepted . But when it goes from arduino error occurs.
The arduino Code is as follows:

client.println("POST /api/trackers/5a28eddaf57a6e2060e85601/solars/5a3bb2adf57a6e1a71ca135b/arduino_data HTTP/1.0");

client.println("Host: 192.168.6.16");

client.println("Accept: application/vnd.mirasol.v1");
Serial.println("After Accept application vnd");

client.println("User-Agent: Arduino/1.0");
Serial.println("After User Agent Arduino");

client.println("Accept: application/json");
Serial.println("After Accept application json");

client.println("Content-Length: ");
Serial.println("After content length");

client.println(postdata.length());

client.println("Content-Type: application/json");
Serial.println("After content type application json");

client.println("Connection: close");
Serial.println("After connection close");

client.println();
Serial.println("After client println");

client.println(postdata);
Serial.println("After post data");
Serial.println(postdata);


The output in the serial monitor is as follows:

    connecting...
connected
After Accept application vnd
After User Agent Arduino
After Accept application json
After content length
After content type application json
After connection close
After client println
After post data
{"current":10.50, "voltage":10.50}
H
disconnecting.


And the error shown in localhost is as follows:

2017-12-27 15:21:57 +0530: HTTP parse error, malformed request (): #&lt;Puma::HttpParserError: Invalid HTTP format, parsing fails.&gt;


I have the application in Ruby on Rails with Mongoid as the DB.

FYI: New to coding..
Your problem most likely stems from this bit:

client.println("Content-Length: ");
Serial.println("After content length");

client.println(postdata.length());


You have an extraneous "ln" in there causing the post data length to be on a separate line from the Content-Length:

Content-Length:
23


You should change the first println to a print. Also the order could do with changing to keep things logically grouped:

client.print("Content-Length: ");
client.println(postdata.length());

Serial.println("After content length");


Which would result in:

Content-Length: 23