LeNI
LeNI

Reputation: 1184

Swift 5.1 & Alamofire 5.1 : GET method ERROR

when passing header and params: Alamofire.AFError.URLRequestValidationFailureReason.bodyDataInGETRequest(0 bytes)

 AF.request(urlString,method:.get, parameters: parameters, encoding: URLEncoding.httpBody, headers: headers).responseJSON { response in

              print(response)

 }

Upvotes: 0

Views: 1566

Answers (1)

Jon Shier
Jon Shier

Reputation: 12770

As of Apple's 2019 OS versions, trying to make a GET request with body data will fail with an error. The value must be nil. Alamofire provides it's own error here in order to provide a consistent experience for Alamofire users, regardless of which OS their code is running on.

Upvotes: 1

Related Questions