title: Read response as string wininet
body: <p>This function creates a post request to an endpoint and receives a JSON response, the goal is to save the json data as a string.
  I checked the <a href="https://docs.microsoft.com/en-us/previous-versions/windows/embedded/ms906349(v=msdn.10)" rel="nofollow noreferrer">Microsoft</a> docs but I can't figure it out</p>
  <pre><code>    void POST(std::string data, std::string endpoint ) 
      {
          static TCHAR hdrs[] = _T(&quot;Content-Type: application/json&quot;);
          static LPCSTR accept[2]={&quot;*/*&quot;, NULL};
          // for clarity, error-checking has been removed
          HINTERNET hSession = InternetOpen(DEFAULT_USERAGENT, INTERNET_OPEN_TYPE_PRECONFIG, NULL, NULL, 0);
          HINTERNET hConnect = InternetConnect(hSession, MY_HOST, ALT_HTTP_PORT , NULL, NULL, INTERNET_SERVICE_HTTP, 0, 1);
          HINTERNET hRequest = HttpOpenRequest(hConnect, &quot;POST&quot;, endpoint.c_str(), NULL, NULL, accept, 0, 1);
          HttpSendRequest(hRequest, hdrs, strlen(hdrs), (PVOID)data.c_str() , data.length());
          // close any valid internet-handles
      }
  
  </code></pre>