title: How to post data with a ContentType of 'multipart/form-data' in Delphi REST?
body: <p>I am trying to send a request to a REST API using <code>multipart/form-data</code> as the content type.</p>
  
  <p>I always get "HTTP/1.1 500 Internal Error" as a response.</p>
  
  <p>I tried sending requests to methods that require <code>application/x-www-form-urlencoded</code> and had success, though.</p>
  
  <p>How can I achieve getting a success response from my API using <code>multipart/form-data</code>?</p>
  
  <p>Here is my code:</p>
  
  <pre><code>procedure TForm10.Button1Click(Sender: TObject);
  var
    RESTClient1: TRESTClient;
    RESTRequest1: TRESTRequest;
    strImageJSON : string;
    Input: TIdMultipartFormDataStream;
  begin
    Input := TIdMultipartFormDataStream.Create;
    Input.Clear;
    Input.AddFormField('Email', 'tugba.xx@allianz.com.tr');
    Input.AddFormField('Password', 'xxxx');
    RESTClient1 := TRESTClient.Create('http://192.168.1.172:81/');
    RESTRequest1 := TRESTRequest.Create(nil);
    RESTRequest1.Method := TRESTRequestMethod.rmPOST;
    RESTRequest1.Resource := 'api/Mobile/MobileLoginControl';
    RESTRequest1.AddBody(Input,TRESTContentType.ctMULTIPART_FORM_DATA);
    RESTRequest1.Client := RESTClient1;
    RESTRequest1.Execute;
    strImageJSON := RESTRequest1.Response.Content;
  end;
  </code></pre>