Swift PublishDocumentation Docs SPM compatible codebeat badge License
A convenience wrapper around Swift's Combine and URLSession to make URLRequests
dependencies: [ .package(url: "https://github.com/JZDesign/HTTPEngine.git", .upToNextMajor(from: "0.2.0")) ],
struct Recipes: Codable { let id: String let imageURLs: [String] let title: String let ingredients: [Ingredient] let steps: [Step] } let engine = HTTPEngine() engine .get([Recipes].self, url: "https://my-recipes.com/baby-back-ribs") .assertNoFailure() // don't do this .sink { recipes in }
struct NewUser: Codable { let userName, email, password: String } struct NewUserResponse: Codable { let id, accessToken, scope: String } let newUser = NewUser(userName: "Dudemus", email: "mydude1@electronmail.com", password: "This_R3@LLy_5h0uld_b3_encrypt3d") let engine = HTTPEngine() engine .post(NewUserResponse.self, url: "https://auth.somedomain.com", body: newUser, validator: { 0ドル == 202 }) .catch { // handle non 202 response or other errors } .assign(to: \.user, on: UserStore)
let engine = HTTPEngine() engine .makeRequest(method: .delete, url: "https://not-google.com/", body: data, header: headers, validator: { 0ドル == 204 }) .catch { // handle non 204 response or other errors } .sink { data in // handle response data }
Documentation generated by Jazzy.