Alamofire always gives me an error with status code 500 in response

I ran into the following problem. I am trying to use Alamofire to access multiple web services in my application. This is the code I'm using:

Alamofire.request(.GET, "https://httpbin.org/get")
        .validate()
        .responseJSON { response in
            switch response.result {
            case .Success:
                print("Validation Successful")
            case .Failure(let error):
                print(error)
            }
    }

the result for this is “Successful validation”, and that’s correct, but the problem is that when I try to call my own service, this is the web service URL if someone wants to check this: https://ratid.com/RapidSentry /MiOSService.svc/GetUserIdentity ... This web service is working fine, as you can see, but when I call the same code but with my URL, I get the following error:

Error Domain=com.alamofire.error Code=-6003 "Response status code was unacceptable: 500" UserInfo={NSLocalizedFailureReason=Response status code was unacceptable: 500}

- Android GET-. , . : Xcode 7 Swift.

+5
4

, , Xcode 7 Beta, , . , reset , . , -.

+6

500 , , .

HTTP

+3

StatusCodes Alamofire/validation.swift 200.. < 300-200. < 500

let acceptableStatusCodes: Range<Int> = 200..<300

let acceptableStatusCodes: Range<Int> = 200..<500
+3

:

.validate(statusCode: 200..<500)
+1

Source: https://habr.com/ru/post/1611000/


All Articles