Example directly from the Alamofire github page:
Alamofire.request(.GET, "http://httpbin.org/get", parameters: ["foo": "bar"]) .validate(statusCode: 200..<300) .validate(contentType: ["application/json"]) .response { (_, _, _, error) in println(error) }
In your case, add what you want:
Alamofire.request(.GET, "http://httpbin.org/get", parameters: ["foo": "bar"]) .validate(statusCode: 200..<300) .validate(contentType: ["application/json"]) .validate(Accept: ["application/json"]) .response { (_, _, _, error) in println(error) }
source share