Deployd 不断返回 Status 204
Deployd keeps returning Status 204
我正在开发一个 iOS 应用程序并使用 Deployd 作为后端。问题是当我使用 sid cookie 向 users/me 发送 GET 请求以识别我的会话时,它 returns 204-没有内容,即使用户已登录。我期待 return.
中的一些数据
Xcode 控制台输出:
<NSHTTPURLResponse: 0x136ed2e00> { URL: http://xxxxxxxxxxxxxxx:2403/users/me?sid=3f53dd6c10...9fc4a00 } { status code: 204, headers {
"Cache-Control" = "no-cache, no-store, must-revalidate";
Connection = "keep-alive";
Date = "Sat, 16 Jan 2016 18:55:16 GMT";
Expires = 0;
Pragma = "no-cache"; } }
所以我将 SID 作为参数发送,这是不正确的。已部署需要 'barrier token'.
Swift代码:
let url = NSURL(string: "http:/xxxxxxxxxxxxxxxx.com:2403/users/me")
let request = NSMutableURLRequest(URL: url!)
request.HTTPMethod = "GET"
request.setValue( "Bearer \(token!)", forHTTPHeaderField: "Authorization")
NSURLConnection.sendAsynchronousRequest(request, queue: NSOperationQueue.currentQueue()!) { response, maybeData, error in
if let data = maybeData {
let contents = NSString(data:data, encoding:NSUTF8StringEncoding)
print(contents!, "bitch")
} else {
print(error!.localizedDescription)
}
}
我正在开发一个 iOS 应用程序并使用 Deployd 作为后端。问题是当我使用 sid cookie 向 users/me 发送 GET 请求以识别我的会话时,它 returns 204-没有内容,即使用户已登录。我期待 return.
中的一些数据Xcode 控制台输出:
<NSHTTPURLResponse: 0x136ed2e00> { URL: http://xxxxxxxxxxxxxxx:2403/users/me?sid=3f53dd6c10...9fc4a00 } { status code: 204, headers {
"Cache-Control" = "no-cache, no-store, must-revalidate";
Connection = "keep-alive";
Date = "Sat, 16 Jan 2016 18:55:16 GMT";
Expires = 0;
Pragma = "no-cache"; } }
所以我将 SID 作为参数发送,这是不正确的。已部署需要 'barrier token'.
Swift代码:
let url = NSURL(string: "http:/xxxxxxxxxxxxxxxx.com:2403/users/me")
let request = NSMutableURLRequest(URL: url!)
request.HTTPMethod = "GET"
request.setValue( "Bearer \(token!)", forHTTPHeaderField: "Authorization")
NSURLConnection.sendAsynchronousRequest(request, queue: NSOperationQueue.currentQueue()!) { response, maybeData, error in
if let data = maybeData {
let contents = NSString(data:data, encoding:NSUTF8StringEncoding)
print(contents!, "bitch")
} else {
print(error!.localizedDescription)
}
}