RealHTTP is a lightweight yet powerful client-side HTTP library.
Our goal is make an easy to use and effortless http client for Swift.


Feature Highlights

  • Sync/Async & Queued Requests
  • Elegant Request Builder with Chainable Response
  • Combine Support (soon Async/Await!)
  • Retry/timeout, Validators Control
  • URI Template support for parameter’s build
  • URL/JSON, Multipart Form/File Upload
  • JSON decoding via Codable
  • Upload/Download progress tracker
  • URL Metrics Tracker
  • cURL Description
  • SSL Pinning, Basic/Digest Authentication
  • TSL Certificate and Public Key Pinning
  • Advanced HTTP Stub

Simple HTTP Client

Making an async http request is easier than ever:

HTTPRequest<Joke>("").run().onResult { joke in
    // decoded Joke object instance

In this case you are executing a request inside the shared HTTPClient, a shared client which manage your requests.
Sometimes you may need to a more fined grained control.
Therefore you can create a custom HTTPClient to execute all your’s webservice network calls sharing a common configuration (headers, cookies, authentication etc.) using the run(in:) method.

let jokeAPIClient = HTTPClient(baseURL: "")
let jokesReq = HTTPRequest<Joke>(.get, "/random_jokes")
               .json(["category": category, "count": countJokes]) // json parameter encoding!

// Instead of callbacks we can also use Combine RX publishers.
jokesReq.resultPublisher(in: jokeAPIClient).sink { joke in
    // decoded Joke object

// Get only the raw server response
jokesReq.responsePublisher(in: ).sink { raw in
    // raw response (with metrics, raw data...)

You can use it with regular callbacks, combine publishers and soon with async/await’s Tasks.

Simple HTTP Stubber

RealHTTP also offer a built-in http stubber useful to mock your network calls for unit testing.
This is a simple URI matching stub:

var stubLogin = HTTPStubRequest()
                .match(URI: "{repository}")
                .stub(for: .post, delay: 5, json: mockLoginJSON))

HTTPStubber.shared.add(stub: stubLogin)

HTTPStubber also support different matchers (regex matcher for url/body, URI template matcher, JSON matcher and more).
This is an example to match Codable entity for a stub:

var stubLogin = HTTPStubRequest()
               .match(object: User(userID: 34, fullName: "Mark"))
               .stub(for: .post, delay: 5, json: mockLoginJSON)

… and more!

But there’s lots more features you can use with RealHTTP.
Check out the Documentation section below to learn more!



RealHTTP can be installed in any platform which supports Swift 5.4+ ON:

  • iOS 13+
  • Xcode 12.5+
  • Swift 5.4+


To use RealHTTP in your project you can use Swift Package Manager (our primary choice) or CocoaPods.

Swift Package Manager

Aadd it as a dependency in a Swift Package, add it to your Package.swift:

dependencies: [
    .package(url: "", from: "1.0.0")

And add it as a dependency of your target:

targets: [
    .target(name: "MyTarget", dependencies: [
        .product(name: "", package: "RealHTTP")

In Xcode 11+ you can also navigate to the File menu and choose Swift Packages -> Add Package Dependency…, then enter the repository URL and version details.


RealHTTP can be installed with CocoaPods by adding pod ‘RealHTTP’ to your Podfile.

pod 'RealHTTP'

Powered Apps

RealHTTP was created by the amazing mobile team at ImmobiliareLabs, the Tech dept at, the first real estate site in Italy.
We are currently using RealHTTP in all of our products.

If you are using RealHTTP in your app drop us a message, we’ll add below.


Support & Contribute

Made with ❤️ by ImmobiliareLabs & Contributors

We’d love for you to contribute to RealHTTP!
If you have any questions on how to use RealHTTP, bugs and enhancement please feel free to reach out by opening a GitHub Issue.

Todo List

If you want to contribuite to the project you can also work on these main topics.

  • Async/Await support for observers
  • Extended the Combine support
  • Complete the test suite


RealHTTP is licensed under the MIT license.
See the
LICENSE file for more information.