 	
 	internal func request(resource: Resource, responseHandler: @escaping ResponseHandler = DataRequestor.defaultResponseHandler) -> Promise<Data> {
 		
-		let _request = {
+		let go = {
 			(req: URLRequest) -> Promise<Data> in
 			return Promise {
 				(fulfill, reject) -> () in
-				let task: URLSessionDataTask = URLSession.shared.dataTask(with: req) {
+				let task: URLSessionDataTask = self.session.dataTask(with: req) {
 					(data, resp, err) -> Void in
 					do {
 						fulfill(try responseHandler(data, resp, err))

			return data
		case 401:
			throw SalesforceError.userAuthenticationRequired
		case 400..<500:
			// Try to form error from Salesforce's response
			// See: https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/errorcodes.htm

				reject(SalesforceError.userAuthenticationRequired)
			}
		}.then {
			return try go(resource.asURLRequest(authData: $0))
		}.recover {
			(error: Error) -> Promise<Data> in
			if case SalesforceError.userAuthenticationRequired = error {
				return self.connectedApp.authorize().then {
					return try go(resource.asURLRequest(authData: $0))
				}
			}
			else {
