title: Alamofire 4 missing parameters in POST
body: <p>Spent hours on this with no success.
  I'm using Alamofire to make a HTTP POST to back end server which requires some parameters to be supplied with request.
  I'm successfully hitting the server but the server is responding with a 500 stating no parameters were sent?</p>
  
  <p>I've tried most of the SO solutions (changing the encoding type, setting parameters as NSDict, etc) but with no success.</p>
  
  <p>Any help greatly appreciated.</p>
  
  <p>PS its Swift3 with Alamofire 4</p>
  
  <p>Code:</p>
  
  <pre><code>let params: [String: String] = ["deviceID": "Some device ID",
                    "email": "email","password": "password","userid": "1234",
                    "username":"gordon"]
  
  let request_params: Parameters = ["LoginUser" : params]
  
  let url = "https://myserver/LogIn" as String
  
  Alamofire.request(url, method: .post, parameters: request_params, encoding:  URLEncoding.default, headers: [
          "Content-Type": "application/x-www-form-urlencoded"
          ]).responseString { (response:DataResponse&lt;String&gt;) in
  
          switch(response.result) {
          case.success(let data):
              print("success",data)
              print(response.response)
          case.failure(let error):
              print("Failed!",error)
  
          }
  
      }
  </code></pre>
  
  <p><strong>Update:</strong></p>
  
  <p>Below is the body of the POST, it looks like this is where the problem exists:</p>
  
  <p><em>Alamofire POST body (from above code) -</em> 
  (LoginUser%5BdeviceID%5D=12345&amp;LoginUser%5Bemail%5D=gordon%40test.com&amp;LoginUser%5Buserid%5D=00000000-0000-0000-0000-000000000000&amp;LoginUser%5Bpassword%5D=testPassword&amp;LoginUser%5Busername%5D=gordon)</p>
  
  <p>It should be something like (ignoring the encoding values):</p>
  
  <p><em>This is a functional post body-</em>
  LoginUser=%7B%22deviceID%22%3A%22%22%2C%22email%22%3A%22gordon%40test.com%22%2C%22password%22%3A%22testPassword%22%2C%22userid%22%3A%2200000000-0000-0000-0000-000000000000%22%2C%22username%22%3A%22gordon%22%7D</p>
  
  <p>As you can see the Alamofire post seems to concatenate the LoginUser to start of each attribute? Also missing the LoginUser= at start??</p>