rectification on getting 400 error from POST request for esp-01 with arduino

Haii all,

I am trying to send some data to server using POST request from esp-01 module connected to arduino uno.
In response, the server is throwing 400 error. I am attaching a piece of code below. Kindly check it and suggest what changes I should do to successfully send data to server.

Thanks in advance.

void httppost () {
  String BatteryStatus = data;
esp.println("AT+CIPSTART=\"TCP\",\"" + server + "\",80");//start a TCP connection.
if( esp.find("OK")) {
Serial.println("server connection ready");
} delay(1000);

String postRequest =

"POST " + uri + " HTTP/1.1\r\n" +

"Host: " + server + "\r\n" +

//"Accept: *" + "/" + "*\r\n" +

//"Content-Length: " + BatteryStatus.length() + "\r\n" +

"Content-Type: application/json\r\n" +

"Cache-Control: no-cache\r\n" +

"\r\n" + data;

String sendCmd = "AT+CIPSEND=";//determine the number of caracters to be sent.
esp.print(sendCmd);
esp.println(postRequest.length() );
//delay(500);
if(esp.find(">")) { Serial.println("Sending.."); esp.print(postRequest);
if( esp.find("SEND OK")) { Serial.println("Packet sent");
memset(data, 0, sizeof(data));
while (esp.available()!= NULL) {
  String tmpResp = esp.readString();
  Serial.println(tmpResp);
  //delay(10000);
  // memset(tmpResp, 0, sizeof(tmpResp));
}
esp.println("AT+CIPCLOSE");
delay(6000);
}
}}

"POST " + uri + " HTTP/1.1\r\n" +you can not have 'white space' in a URL request (and you have a few) you should replace them with '%20' as explained here