How to print url request with header and response JSON
Closed this issue · 3 comments
srinivasanVaradan commented
How to print url request with header and response JSON
tristanhimmelman commented
This has to do more with Alamofire than AlamofireObjectMapper.
Here is a snippet from the Alamofire readme:
Alamofire.request(.GET, "https://httpbin.org/get", parameters: ["foo": "bar"])
.responseJSON { response in
print(response.request) // original URL request
print(response.response) // URL response
print(response.data) // server data
print(response.result) // result of response serialization
if let JSON = response.result.value {
print("JSON: \(JSON)")
}
}
response.response
is a NSHTTPURLResponse object which contains the header data.
srinivasanVaradan commented
to print response you are using responseJSON method instead responseObject . would please give some example to print response from responseObject .
Alamofire.request(.GET, url,parameters:params ,encoding:.URL).responseObject { (response: Response<ClassName, NSError>) in
{
}
AF-cgi commented
Alamofire.request(.GET, url,parameters:params ,encoding:.URL)
.responseObject { (response: Response) in
print(response.request) // original URL request
print(response.response) // URL response
print(response.data) // server data
print(response.result) // result of response serialization
}