I have this basic get request when I call it in app I receive the error below. When I run it in playgrounds I get the same error
If I use a different url from the same db I don't receive any errors. Another strange thing is that if I remove the header "x-access-token" I do not get the error and instead get response 403 which makes sense.
Code Block let url = DevAPI.BaseURL.submitted guard let requestUrl = url else { fatalError() } var request = URLRequest(url: requestUrl) request.httpMethod = "GET" let tokenString = UserDefaults.standard.string(forKey: "name") ?? "" request.setValue(tokenString, forHTTPHeaderField: "x-access-token") let session = URLSession.shared session.dataTask(with: request) { (data, response, error) in if error != nil { print("error :::", error) } else { print("no error", response) } }.resume()
This request is never making it to the server as in the logs I don't see anything show up when its made. Code Block 2020-12-23 12:29:37.815500-0500 Hammoq[63627:1122236] Task <9EAC71EE-DA88-4356-A180-D843E89CC7B9>.<1> HTTP load failed, 5071/0 bytes (error code: 303 [4:-2205]) 2020-12-23 12:29:37.817028-0500 Hammoq[63627:1122236] Task <9EAC71EE-DA88-4356-A180-D843E89CC7B9>.<1> finished with error [303] Error Domain=kCFErrorDomainCFNetwork Code=303 "(null)" UserInfo={_NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <9EAC71EE-DA88-4356-A180-D843E89CC7B9>.<1>, _kCFStreamErrorDomainKey=4, NSErrorPeerAddressKey=<CFData 0x600003820f50 [0x7fff8002e8c0]>{length = 16, capacity = 16, bytes = 0x100201bb23b852d00000000000000000}, _kCFStreamErrorCodeKey=-2205, _NSURLErrorRelatedURLSessionTaskErrorKey=( "LocalDataTask <9EAC71EE-DA88-4356-A180-D843E89CC7B9>.<1>" )} error ::: Optional(Error Domain=kCFErrorDomainCFNetwork Code=303 "(null)" UserInfo={_NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <9EAC71EE-DA88-4356-A180-D843E89CC7B9>.<1>, _kCFStreamErrorDomainKey=4, NSErrorPeerAddressKey=<CFData 0x600003820f50 [0x7fff8002e8c0]>{length = 16, capacity = 16, bytes = 0x100201bb23b852d00000000000000000}, _kCFStreamErrorCodeKey=-2205, _NSURLErrorRelatedURLSessionTaskErrorKey=( "LocalDataTask <9EAC71EE-DA88-4356-A180-D843E89CC7B9>.<1>" )})
If I use a different url from the same db I don't receive any errors. Another strange thing is that if I remove the header "x-access-token" I do not get the error and instead get response 403 which makes sense.