title: Delphi Seattle - Sending Post Request with custom body Responds bad Request 400
body: <p>I would like to send a Post Request to a Rest Server of external Provider. I Have tried with Curl and everything works perfect. Here is the CURL Code:</p>
  
  <pre><code>    curl -X POST -H 'PRODUCT-KEY: SUperL0ngAndSpecialSecretCode' -H 'Content-Type: application/json' -H 'Authorization: Basic CrytedWorksalsowellwithotherget' -i 'http://myserver:8080/rest.svc/v1.0/query' --data '{
  "query":"SELECT Name from Address where name like '\''%me%'\''"
  }'
  </code></pre>
  
  <p>In Curl Everything works fine.
  I have tried for a bunch of hours to get this Code working in Delphi. At this time my code looks like this:</p>
  
  <pre><code>function GetSomeInformation: string;
  var
    lrestrequest: TRESTRequest;
    lRestClient: TRESTClient;
    lRestResponce: TRESTResponse;
  begin
    result := '';
    lRestClient := TRESTClient.Create('http://myserver:8080/rest.svc/v1.0/query');
    try
      lrestrequest := TRESTRequest.Create(nil);
      try
        lRestResponce := TRESTResponse.Create(nil);
        try
          lrestrequest.Client := lRestClient;
          lrestrequest.Response := lRestResponce;
          lrestrequest.Method := rmPost;
          lrestrequest.Params.AddItem('PRODUCT-KEY',
            'SUperL0ngAndSpecialSecretCode',
            TRESTRequestParameterKind.pkHTTPHEADER);
          lrestrequest.Params.AddItem('Content-Type', 'application/json',
            TRESTRequestParameterKind.pkHTTPHEADER);
          lrestrequest.Params.AddItem('query',
            ansitoutf8('SELECT Name from Address where Name like ' +
            quotedstr('%me%')), TRESTRequestParameterKind.pkREQUESTBODY);
          lrestrequest.Execute;
          if not lRestResponce.Status.Success then
            showmessage(lRestResponce.StatusText + ' ' +
              inttostr(lRestResponce.StatusCode))
          else
            result := lRestResponce.Content;
        finally
          lRestResponce.Free;
        end;
      finally
        lrestrequest.Free
      end;
    finally
      lRestClient.Free;
    end;
  end;
  </code></pre>
  
  <p>I have no idea what to do next to get the Work done? Any ideas or ways I can Debug the problem better.</p>
  
  <p>--Update</p>
  
  <p>Okay I Used Wireshark to check if there are any differences between the Post commands, it look like Delphi ignores or broke my Header.
  In the Wireshark snippet there is a Value Content-Type. It should be</p>
  
  <pre><code>Content-Type: application/json
  </code></pre>
  
  <p>But with Delphi I get</p>
  
  <pre><code>Content-Type: application%2Fjson, application/x-www-form-urlencoded
  </code></pre>
  
  <p>And I also miss the Procduct-Key Value.
  Any Suggestions?</p>