我在终端本地调用了Rest API。这就像下面这样:
composite-operation
返回以下输出:
http -v -f --timeout=60 GET 'http://localhost:8080/api/v1/public/users/signin?email=myemail@email.com&password=mypassword'
现在我想使用Alamofire阅读这个JSON数据。我尝试使用responseJSON序列化程序,方法如下:
GET /api/v1/public/users/signin?email=myemail@email.com&password=mypassword HTTP/1.1
Accept: */*
Accept-Encoding: gzip, deflate
Content-Type: application/x-www-form-urlencoded; charset=utf-8
Host: localhost:8080
User-Agent: HTTPie/0.8.0
HTTP/1.1 400 Bad Request
Content-Type: application/json
Date: Mon, 28 Mar 2016 16:59:08 GMT
Set-Cookie: rememberMe=deleteMe; Path=/; Max-Age=0; Expires=Sun, 27- Mar-2016 16:59:13 GMT
Transfer-Encoding: chunked
{
"debugMessage": "Submitted credentials for token [org.apache.shiro.authc.UsernamePasswordToken - najmul@qianalysis.com, rememberMe=true] did not match the expected credentials.Submitted credentials for token [org.apache.shiro.authc.UsernamePasswordToken - najmul@qianalysis.com, rememberMe=true] did not match the expected credentials.: The subject was expected to be true, but was false",
"errorCode": "INCORRECT_CREDENTIALS",
"logId": "50a695c1a81e0542",
"stackTrace": "org.niopack.r.....
}
但是我得到jsonData为零。如果你在这里,你会怎么做?
感谢。
答案 0 :(得分:3)
我删除validate()
允许我查看请求失败的原因。出于某种原因,当validate
失败时,不会解析响应的数据。