Swiftpack.co - avreolko/VCHTTPNetworking as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by avreolko.
avreolko/VCHTTPNetworking 3.1.0
Simple and declarative request builder
⭐️ 0
🕓 2 years ago
iOS
.package(url: "https://github.com/avreolko/VCHTTPNetworking.git", from: "3.1.0")

Tests

VCHTTPNetworking

A simple declarative builder for your network requests

Installation

Install with SPM 📦

Usage

let requestBuilder = RequestBuilder(baseURL: URL(string: "<some url>")!)

let request: Request<ResponseType> =
    requestBuilder
        .method(.get)
        .basicAuth(login: "login", pass: "pass")
        .headers(["key": "value"])
        .path("endpoint")
        .build()

request.start { result in
    switch result {
    case .success(let response): ()
    case .failure(let error): ()
    }
}

The request holds a strong reference to itself until a response. If you need lifecycle management for your async operations, you can use promises.

Features

  • SSL-pinning
  • Response mocking
  • Support of multiple authorization types. Certificate / OAuth / basic / bearer.
  • Custom coding support. Default is JSONEncoder / JSONDecoder.

License

This project is released under the MIT license.

GitHub

link
Stars: 0
Last commit: 2 years ago
Advertisement: IndiePitcher.com - Cold Email Software for Startups

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics