title: How to pass data in Poco HTTPRequest
body: <p>This is regarding to my project, Where I am write Poco SSL client to communicate with a server.</p>
  
  <p>I am able to do (i) Basic Auth (ii) Cert exchange. But after sending post request I am facing "Error 500".</p>
  
  <p>Let me explain it=></p>
  
  <p>I have a working curl:</p>
  
  <pre><code>curl -d '{"name":"com.my.session.value"}' -H 'Content-Type: application/json' -H 'Accept: application/json' -E MyCert.pem --key MyKey.pem -u testuser -k -vvv https://&lt;server-ip&gt;:&lt;port&gt;/Internal/directory/path
  </code></pre>
  
  <p>using this I am able to print data on console. So tried to write same in Poco/C++:</p>
  
  <pre><code>// I have handler for keyPassparse, cert, invalid-cert-handler and used them in below line
  SSLManager::instance().initializeClient(parse_str, Cert, ptrContext);
  
  URI uri(argv[1]);
  Poco::Net::HTTPSClientSession session(uri.getHost(), uri.getPort());
  session.setKeepAlive(true);
  Poco::Net::HTTPRequest req(Poco::Net::HTTPRequest::HTTP_POST, uri.getPath(), Poco::Net::HTTPMessage::HTTP_1_1);
  HTTPBasicCredentials cred("testuser", "secret");
  
      //Here I tried to add headers and data
  
      cred.authenticate(req);
      req.add("Content-Type","application/json");
      req.add("Accept","application/json");
      req.add("data","com.my.session.value"); // try-1 to add data
      req.setKeepAlive(true);
      std::ostream&amp; myOStream = session.sendRequest(req);
      std::string body("name=com.my.session.value"); // try-2 to add data
      myOStream &lt;&lt; body;
  
      Poco::Net::HTTPResponse response;
      std::istream&amp; rs = session.receiveResponse(response);
      std::cout &lt;&lt; response.getStatus() &lt;&lt; " " &lt;&lt; response.getReason() &lt;&lt; std::endl;
  }
  catch (Exception&amp; exc)
  {
      std::cerr &lt;&lt; exc.displayText() &lt;&lt; std::endl;
      return 1;
  }
  
  return 0;
  </code></pre>
  
  <p>}</p>
  
  <p>This is always returning Error:500 (Internal server error)
  Which means my data section is not reaching properly.</p>
  
  <p>Please suggest me a way to pass proper "data" section to server.</p>
  
  <p>Thanks in advance.</p>