title: Multipartform data not passing in all params to server-Swift 3
body: <p>My requirement is to upload a recorded audio file with a file name and duration to a server using REST API</p>
  
  <p>The code I have to form the multipart form data is as below</p>
  
  <pre><code>private func createRequestBody(boundary:"--BXDFG", multidata:Data, mime:"audio/mp4", filePathKey:"file", filename:"test", metas:["title":"Mytitle","duration":"30"] -&gt; Data {
  
          var body = Data()
  
          body.append(Data("--\(boundary)\r\n".utf8))
          body.append(Data("Content-Disposition: form-data; name=\"\(filePathKey)\"; filename=\"\(filename)\"\r\n".utf8))
          body.append(Data("Content-Type: \(mime)\r\n\r\n".utf8))
          body.append(multidata)
          body.append(Data("\r\n".utf8))
          if (metas != nil) {
  
              for (key, value) in metas! {
  
                  body.append(Data("--\(boundary)\r\n".utf8))
                  body.append(Data("Content-Disposition: form-data; name=\"\(key)\"\r\n".utf8))
                  body.append(Data((value as! String).utf8))
                  body.append(Data("\r\n".utf8))
              }
  
          }
          body.append(Data("--\(boundary)--\r\n".utf8))
  
          return body
  
      }
  </code></pre>
  
  <p>What I am doing is passing the audio as NSDATA and in a for loop I am adding "title" and "duration" to the multipart form request</p>
  
  <p>On server side, I have below code</p>
  
  <pre><code>@api.route('/upload/&lt;userid&gt;', methods=['POST'])
  def upload(userid):
      if request.method == 'POST':
          if 'title' not in request.form:
              return jsonify({'error': 'Need a valid title for uploaded file', 'code': 403})
  </code></pre>
  
  <p>if "title" is not passed in multipart form data then the server will return an error response.</p>
  
  <p>In my case, even though, "title" is added as a part of the request, the data is not passed to the server and the server returns an error. If I just pass the audio data alone, removing the validation for "title" on server side, then the audio data is uploaded successfully to the server.</p>
  
  <p>I am not able to understand why "title" and "data" are not passed to server</p>
  
  <p>PS: The API request works fine in POSTMAN client.</p>
  
  <p>Thanks </p>