为什么Alamofire GET' If-None-Match'不起作用?

时间:2016-09-02 09:07:12

标签: ios swift http alamofire

例如,我有以下代码:

let headers = ["If-None-Match": etag, "Authorization": "Token token=\(apiKey)"]

Alamofire.request(.GET, "\(AppSettings.ApiURL)/v1/users/", headers: headers).responseJSON { response in

    guard let statusCode = response.response?.statusCode else {return}
    print("status code: \(statusCode)")
}

我每次都会获得status code: 200,而不是304。返回304 status code与curl或postman相同的请求。我不知道哪里出错了。任何帮助都非常感谢!

0 个答案:

没有答案