-
Notifications
You must be signed in to change notification settings - Fork 4
Open
Description
i am using simple example in https://github.com/openziti/ziti-sdk-swift/tree/main/cziti.sample-ios:
urlSession.dataTask(with: urlReq) { (data, response, error) in
guard error == nil else {
self.setScrollableText(error!.localizedDescription)
return
}
var docStr = ""
if let response = response as? HTTPURLResponse {
docStr += "Status: \(response.statusCode) " +
"(\(HTTPURLResponse.localizedString(forStatusCode: response.statusCode)))\n" +
response.allHeaderFields.compactMap {
"\($0): \($1)\n"
}.joined() + "\n"
}
if let data = data, let str = String(data: data, encoding: .utf8) {
docStr += "URL Req: \(urlReq.url?.absoluteString ?? "-")\n" + "URL Res: \(response?.url?.absoluteString ?? "-")\n" + "Authorization: Bearer \(token)\n\n" + str
} else {
docStr += "...Unable to decode body to string..."
}
self.setScrollableText(docStr)
}.resume()
}
Metadata
Metadata
Assignees
Labels
No labels