Strange thing happened to me while implementing networking based on Alamofire
. So, my backend can return me 409
and when I get it I want to react properly, so I went for a regular solution:
Alamofire.request(someRequest).responseJSON { response in
switch response.result {
case .Success(let value):
// I get 409 here...
if response.response?.statusCode == 409 {
// ...
}
case .Failure(let error):
// While it should be here...
}
}
Why is it happening? Is it some sort of backend issue or what? I can only thing of one explanation: Request completed, so it's .Success
even though you got 409
, but this explanation doesn't convince me