我正在使用Alamofire
3并且我正在调用的终点(我不拥有服务器)接受POST
请求并返回HTML
作为响应。< / p>
我在命令行中使用curl
时能够获得HTML响应,但是Alamofire
不返回响应正文,而只返回标题。< / p>
这是我的代码:
let headers = [
"Referer": "SOMEURL"
]
Alamofire.request(.POST, url, headers: headers)
.validate()
.response { request, response, data, error in
// do something with response
}
response
是:
Optional(<NSHTTPURLResponse: 0x7f9ba3759760> { URL: SOMEURL } { status code: 200, headers {
Connection = "keep-alive";
"Content-Encoding" = gzip;
"Content-Type" = "text/html";
Date = "Thu, 22 Sep 2016 15:19:20 GMT";
Server = nginx;
"Transfer-Encoding" = Identity;
Vary = "Accept-Encoding";
} })
和data
是:
Optional<NSData>
- Some : <>
有什么想法吗?