I have a API with post method and following is the code for it
func addScheduleService() {
let parameter = ["start_time":"06:00","end_time":"09:00","schedule_date":"07/23/2020","schedule_id":"0"]
print("parameter is",parameter)
let header: HTTPHeaders = ["Content-Type":"application/json","x-token": self.token!]
AF.request(mainURL+URLS.addschedule.rawValue, method: .post, parameters: parameter, encoding: JSONEncoding.default, headers: header)
.responseJSON {
response in
switch response.result {
case .success(let json):
print("value is",json)
case .failure(let error):
print("error is",error)}
}
}
The response in the postman is as follows:
The output from the code is responseSerializationFailed(reason: Alamofire.AFError.ResponseSerializationFailureReason.inputDataNilOrZeroLength)
What could be the error?
