I working on an iOS app, that I use "Alamofire" for make API request, I test API(which created with Slim framework) by postman, but I couldn't get equivalent request of postman by Alamofire.
and I try Alamofire as below:
let parm = ["Password_Father": "test", "Username_Father": "test"]
let headers : HTTPHeaders = ["content-type": "application/json"]
AF.request(URL(string: "http://my.domain.com/page1/login")!,
method: .get, // also try it as post but get error 500 as postman when using post method
parameters:parm,
encoding: JSONEncoding.default,
headers: headers)
.validate(statusCode: 200..<300)
.responseJSON { response in
switch response.result
{
case .success(_) :do {
print("success")
}
case .failure(let error):
print("failure(error)",error)
break
}
}
but I get this error failure(error) urlRequestValidationFailed(reason: Alamofire.AFError.URLRequestValidationFailureReason.bodyDataInGETRequest)
How can I get equivalent request of postman by Alamofire.