title: Alamofire 4.3 with Swift 3 , POST request does not working with URL Parameters
body: <p>I am trying to send a post request as follows, My Router as follows</p>
  
  <pre><code>enum ProfieRouter: URLRequestConvertible {
  
  case loginUser(parameters: Parameters)
  case resetPassword(parametrs: Parameters)
  
  var method: HTTPMethod {
  
      switch self {
  
      case .loginUser:
          return .post
  
      case .resetPassword:
          return .post
      }
  }
  
  var path: String {
  
      switch self {
      case .loginUser:
          return "app/api.php?request=login"
  
      case .resetPassword:
          return "app/api.php?request=forgettenPassword"
      }
  }
  
  func asURLRequest() throws -&gt; URLRequest {
      let BASEURL = "https://www.example.com/"
      let url = try BASEURL.asURL()
      var urlRequest = URLRequest(url: url.appendingPathComponent(path))
      urlRequest.httpMethod = method.rawValue
  
  
      switch self {
  
      case .loginUser(let parameters):
          urlRequest = try URLEncoding.default.encode(urlRequest, with: parameters)
  
      case .resetPassword(let parameters):
          urlRequest = try URLEncoding.default.encode(urlRequest, with: parameters)
      }
      return urlRequest
  }
  </code></pre>
  
  <p>}</p>
  
  <p>This is how i call it from ViewController,</p>
  
  <pre><code>@IBAction func signInButtonClicked(_ sender: Any) {
  
      let parameters: Parameters = [
          "email": "xxxxxx",
          "password": "xxxxxx"
      ]
  
      Alamofire.request(ProfieRouter.loginUser(parameters: parameters)).responseJSON{ response in
  
  
          switch response.result {
          case .success:
              print(response)
  
              break
          case .failure(let error):
  
              print(error)
          }
  
      }
  
  }
  </code></pre>
  
  <p>But i got following error as follows,</p>
  
  <pre><code>responseSerializationFailed(Alamofire.AFError.ResponseSerializationFailureReason.jsonSerializationFailed(Error Domain=NSCocoaErrorDomain Code=3840 "Invalid value around character 0." UserInfo={NSDebugDescription=Invalid value around character 0.}))
  </code></pre>
  
  <p>Please note that, my API response is a valid when i checked with POSTMAN and Advanced REst Client. And i have tried several question regarding following error but non of them work in my case. </p>
  
  <p>Please can someone point out the mistake i have done here.
  Thank you.</p>