Skip to content
This repository has been archived by the owner on Aug 20, 2020. It is now read-only.

CombineExtensions/CxValidate

Repository files navigation

CxValidate

A µFramework for HTTP Request Validation with Combine

Build Status Current Version swift-package-manager platforms swift-version license

The validate() operator checks that a valid HTTPURLResponse was returned with a status code in the range of 200...299 and forwards along the Data returned from the request.

let cancellable = URLSession.shared
  .dataTaskPublisher(for: URL(string: "https://someurl.com/"))
  .validate()
  .sink { (response: Data) in
    // Do something with your data
  }