       uploadManager.session.invalidateAndCancel()
       
       return Disposables.create()
-    }
-    .map { [weak self] () -> Void in
-      self?.uploadManager = SessionManager(configuration: configuration)
+      }
+      .map { [weak self] () -> Void in
+        self?.uploadManager = SessionManager(configuration: configuration)
     }
   }
   

      
      uploadManager.upload(multipartFormData: { [weak self] (multipartFormData) in
        self?.enrichMultipartFormData(multipartFormData: multipartFormData, from: uploadRequestParameters)
      }, to: requestURL.absoluteString,
         headers: requestHeaders,
         encodingCompletion: {  (encodingResult) in
          switch encodingResult {
          case .success(let uploadRequest, _, _):
            if let urlSessionTask = uploadRequest.task {
              observer.onNext(urlSessionTask)
              observer.onCompleted()
            }
          case .failure(let error):
            observer.onError(error)
          }
      })
      
      return Disposables.create()
    })
    .subscribeOn(ConcurrentDispatchQueueScheduler(queue: queue))
  }
  
  fileprivate func enrichMultipartFormData(multipartFormData: MultipartFormData,

  // MARK: - Setup
  
  public init(baseURL: String,
              keychainService: KeychainService,
              requestManager: Alamofire.SessionManager = Alamofire.SessionManager(),
              uploadManager: SessionManager? = nil,
              askCredentialHandler: AskCredentialHandler? = nil) {
    
    self.baseURL = baseURL
    self.keychainService = keychainService
