{"id":19045056,"url":"https://github.com/immobiliare/realhttp","last_synced_at":"2025-05-16T08:03:20.238Z","repository":{"id":39332141,"uuid":"409666569","full_name":"immobiliare/RealHTTP","owner":"immobiliare","description":"🌀swift async http client - fast, lightweight, type-safe","archived":false,"fork":false,"pushed_at":"2025-02-10T17:04:28.000Z","size":2512,"stargazers_count":287,"open_issues_count":11,"forks_count":29,"subscribers_count":13,"default_branch":"main","last_synced_at":"2025-05-09T08:04:21.998Z","etag":null,"topics":["alamofire","api","async-await","http","http-client","ios","json","metrics","networking","rest","rest-api","stub","stub-server","swift","urlrequest","urlsession"],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/immobiliare.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-09-23T16:30:23.000Z","updated_at":"2025-04-19T13:19:30.000Z","dependencies_parsed_at":"2024-01-13T22:54:28.224Z","dependency_job_id":"c0265af8-a5fc-4331-8ec3-5f08aa92d901","html_url":"https://github.com/immobiliare/RealHTTP","commit_stats":{"total_commits":423,"total_committers":14,"mean_commits":"30.214285714285715","dds":0.0685579196217494,"last_synced_commit":"c0ffb265eae8684da02ad20cfcc147c23463ad95"},"previous_names":[],"tags_count":32,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/immobiliare%2FRealHTTP","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/immobiliare%2FRealHTTP/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/immobiliare%2FRealHTTP/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/immobiliare%2FRealHTTP/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/immobiliare","download_url":"https://codeload.github.com/immobiliare/RealHTTP/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254493381,"owners_count":22080126,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["alamofire","api","async-await","http","http-client","ios","json","metrics","networking","rest","rest-api","stub","stub-server","swift","urlrequest","urlsession"],"created_at":"2024-11-08T22:48:38.479Z","updated_at":"2025-05-16T08:03:20.216Z","avatar_url":"https://github.com/immobiliare.png","language":"Swift","readme":"\u003cp align=\"center\"\u003e\n\u003cpicture\u003e\n  \u003csource media=\"(prefers-color-scheme: dark)\" srcset=\"./Documentation/assets/realhttp-dark.png\" width=\"350\"\u003e\n  \u003cimg alt=\"logo-library\" src=\"./Documentation/assets/realhttp-light.png\" width=\"350\"\u003e\n\u003c/picture\u003e\n\u003c/p\u003e\n\n[![Swift](https://img.shields.io/badge/Swift-5.3_5.4_5.5_5.6-orange?style=flat-square)](https://img.shields.io/badge/Swift-5.3_5.4_5.5_5.6-Orange?style=flat-square)\n[![Platform](https://img.shields.io/badge/Platforms-iOS%20%7C%20macOS%20%7C%20watchOS%20%7C%20tvOS%20%7C%20Linux-4E4E4E.svg?colorA=28a745)](#installation)\n[![Swift Package Manager](https://img.shields.io/badge/Swift_Package_Manager-compatible-orange?style=flat-square)](https://img.shields.io/badge/Swift_Package_Manager-compatible-orange?style=flat-square)\n[![CocoaPods Compatible](https://img.shields.io/cocoapods/v/RealHTTP.svg?style=flat-square)](https://img.shields.io/cocoapods/v/RealHTTP.svg)\n\nRealHTTP is a lightweight yet powerful async-based HTTP library made in Swift.  \nThis project aims to make an easy-to-use, effortless HTTP client based on all the best new Swift features.\n\n## What will you get?\n\nBelow is a simple HTTP call in RealHTTP.\n\n```swift\nlet todo = try await HTTPRequest(\"https://jsonplaceholder.typicode.com/todos/1\")\n           .fetch(Todo.self)\n```\nOne line of code, including the automatic decode from JSON to object.  \n\nOf course, you can fully configure the request with many other parameters. Take a look here:\n\n```swift\nlet req = HTTPRequest {\n  // Setup default params\n  $0.url = URL(string: \"https://.../login\")!\n  $0.method = .post\n  $0.timeout = 15\n\n  // Setup some additional settings\n  $0.redirectMode = redirect\n  $0.maxRetries = 4\n  $0.headers = HTTPHeaders([\n    .init(name: .userAgent, value: myAgent),\n    .init(name: \"X-API-Experimental\", value: \"true\")\n  ])\n   \n  // Setup URL query params \u0026 body\n  $0.addQueryParameter(name: \"full\", value: \"1\")\n  $0.addQueryParameter(name: \"autosignout\", value: \"30\")\n  $0.body = .json([\"username\": username, \"pwd\": pwd])\n}\nlet _ = try await req.fetch()\n```\n\nThe code is fully type-safe.\n\n## What about the stubber?\nIntegrated stubber is perfect to write your own test suite:\n\nThat's a simple stubber which return the original request as response:\n\n```swift     \nlet echoStub = HTTPStubRequest().match(urlRegex: \"*\").stubEcho()\nHTTPStubber.shared.add(stub: echoStub)\nHTTPStubber.shared.enable()\n```\n\nOf course you can fully configure your stub with rules (regex, URI template and more):\n\n```swift\n// This is a custom stubber for any post request.\nvar stub = HTTPStubRequest()\n      .stub(for: .post, { response in\n        response.responseDelay = 5\n        response.headers = HTTPHeaders([\n          .contentType: HTTPContentType.bmp.rawValue,\n          .contentLength: String(fileSize,\n        ])\n        response.body = fileContent\n      })\nHTTPStubber.shared.add(stub: stub)\n```\n\nThat's all!\n\n## Feature Highlights\n\nRealHTTP offers lots of features and customization you can find in our extensive documentation and test suite.  \nSome of them are:\n\n- **Async/Await** native support\n- **Requests queue** built-in\n- Based upon **native URLSession** technology\n- Advanced **retry mechanisms**\n- Chainable \u0026 customizable **response validators** like Node's Express.js\n- Automatic **Codable object encoding/decoding**\n- **Customizable decoding** of objects\n\nAnd for pro users:\n\n- Powerful integrated **HTTP Stub** for your mocks\n- **Combine** publisher adapter \n- **URI templating** system\n- **Resumable download/uploads** with progress tracking\n- Native **Multipart Form Data** support\n- Advanced URL **connection metrics** collector\n- **SSL Pinning**, Basic/Digest Auth\n- **TSL Certificate** \u0026 Public Key Pinning\n- **cURL** debugger\n\n## Documentation\n\nRealHTTP provides an extensive documentation.  \n\n- [**1 - Introduction**](./Documentation/1.Introduction.md)\n- [**2 - Build \u0026 Execute a Request**](./Documentation/2.Build_Request.md#build--execute-a-request)\n   - [Initialize a Request](./Documentation/2.Build_Request.md#initialize-a-request)\n      - [Standard](./Documentation/2.Build_Request.md#standard)\n      - [URI Template](./Documentation/2.Build_Request.md#uri-template)\n      - [Builder Pattern](./Documentation/2.Build_Request.md#builder-pattern)\n   - [Setup Query Parameters](./Documentation/2.Build_Request.md#setup-query-parameters)\n   - [Setup Headers](./Documentation/2.Build_Request.md#setup-headers)\n   - [Setup Request Body](./Documentation/2.Build_Request.md#setup-request-body)\n      - [URL Query Parameters](./Documentation/2.Build_Request.md#url-query-parameters)\n      - [Raw Data \u0026 Stream](./Documentation/2.Build_Request.md#raw-data--stream)\n      - [Plain Strings](./Documentation/2.Build_Request.md#plain-strings)\n      - [JSON Data](./Documentation/2.Build_Request.md#json-data)\n      - [Multipart-Form-Data](./Documentation/2.Build_Request.md#multipart-form-data)\n   - [The HTTP Client](./Documentation/2.Build_Request.md#the-http-client)\n      - [Shared Client](./Documentation/2.Build_Request.md#shared-client)\n      - [Custom Client](./Documentation/2.Build_Request.md#custom-client)\n   - [Execute a Request](./Documentation/2.Build_Request.md#execute-a-request)\n   - [Modify a Request](./Documentation/2.Build_Request.md#modify-a-request)\n   - [Cancel a Request](./Documentation/2.Build_Request.md#cancel-a-request)\n   - [The HTTP Response](./Documentation/2.Build_Request.md#the-http-response)\n      - [Decode using Codable \u0026 Custom Decoding](./Documentation/2.Build_Request.md#decode-using-codable--custom-decoding)\n      - [Decode Raw JSON using JSONSerialization](./Documentation/2.Build_Request.md#decode-raw-json-using-jsonserialization)\n- [**3 - Advanced HTTP Client**](./Documentation/3.Advanced_HTTPClient.md#advanced-http-client)\n   - [Why using a custom HTTPClient](./Documentation/3.Advanced_HTTPClient.md#why-using-a-custom-httpclient)\n   - [Validate Responses: Validators](./Documentation/3.Advanced_HTTPClient.md#validate-responses-validators)\n      - [Approve the response](./Documentation/3.Advanced_HTTPClient.md#approve-the-response)\n      - [Fail with error](./Documentation/3.Advanced_HTTPClient.md#fail-with-error)\n      - [Retry with strategy](./Documentation/3.Advanced_HTTPClient.md#retry-with-strategy)\n   - [The Default Validator](./Documentation/3.Advanced_HTTPClient.md#the-default-validator)\n   - [Alt Request Validator](./Documentation/3.Advanced_HTTPClient.md#alt-request-validator)\n   - [Custom Validators](./Documentation/3.Advanced_HTTPClient.md#custom-validators)\n   - [Retry After [Another] Call](./Documentation/3.Advanced_HTTPClient.md#retry-after-another-call)\n   - [Retry by modify the original request](./Documentation/3.Advanced_HTTPClient.md#retry-by-modify-the-original-request)\n- [**4 - Handle Large Data Request**](./Documentation/4.Handle_LargeData_Requests.md#handle-large-data-request)\n   - [Track Progress](./Documentation/4.Handle_LargeData_Requests.m#track-progress)\n   - [Cancel Downloads with resumable data](./Documentation/4.Handle_LargeData_Requests.md#cancel-downloads-with-resumable-data)\n   - [Resume Downloads](./Documentation/4.Handle_LargeData_Requests.md#resume-downloads)\n- [**5 - Security Options**](./Documentation/5.Security_Options.md#security-options)\n   - [Configure security (SSL/TSL)](./Documentation/5.Security_Options.md#configure-security-ssltsl)\n   - [Self-Signed Certificates](./Documentation/5.Security_Options.md#self-signed-certificates)\n- [**6 - Other Debugging Tools**](./Documentation/6.Other_Debugging_Tools.md#other-debugging-tools)\n   - [cURL Command Output](./Documentation/6.Other_Debugging_Tools.md#curl-command-output)\n   - [Monitor Connection Metrics](./Documentation/6.Other_Debugging_Tools.md#monitor-connection-metrics)\n- [**7 - HTTP Stubber**](./Documentation/7.Stubber.md#http-stubber)\n   - [Using HTTPStubber in your unit tests](./Documentation/7.Stubber.md#using-httpstubber-in-your-unit-tests)\n   - [Stub a Request](./Documentation/7.Stubber.md#stub-a-request)\n   - [Stub Matchers](./Documentation/7.Stubber.md#stub-matchers)\n      - [Echo Matcher](./Documentation/7.Stubber.md#echo-matcher)\n      - [Dynamic Matcher](./Documentation/7.Stubber.md#dynamic-matcher)\n      - [URI Matcher](./Documentation/7.Stubber.md#uri-matcher)\n      - [JSON Matcher](./Documentation/7.Stubber.md#json-matcher)\n      - [Body Matcher](./Documentation/7.Stubber.md#body-matcher)\n      - [URL Matcher](./Documentation/7.Stubber.md#url-matcher)\n      - [Custom Matcher](./Documentation/7.Stubber.md#custom-matcher)\n   - [Add Ignore Rule](./Documentation/7.Stubber.md#add-ignore-rule)\n   - [Unhandled Rules](./Documentation/7.Stubber.md#unhandled-rules)\n   - [Bad and down network](./Documentation/7.Stubber.md#bad-and-down-network)\n      - [Simulate Network Conditions](./Documentation/7.Stubber.md#simulate-network-conditions)\n      - [Simulate a down network](./Documentation/7.Stubber.md#simulate-a-down-network)\n         \n## API Reference\n\nRealHTTP is fully documented at source-code level. You'll get autocomplete with doc inside XCode for free; moreover you can read the full Apple's DoCC Documentation automatically generated thanks to [**Swift Package Index**](https://swiftpackageindex.com) Project from here:\n\n👉 [API REFERENCE](https://swiftpackageindex.com/immobiliare/RealHTTP)\n## Test Suite\n\nRealHTTP has an extensive unit test suite covering many standard and edge cases, including request build, parameter encoding, queuing, and retries strategies.  \nSee the XCTest suite inside `Tests/RealHTTPTests` folder.\n\n## Requirements\n\nRealHTTP can be installed on any platform which supports:\n\n- iOS 13+, macOS Catalina+, watchOS 6+, tvOS 13+\n- Xcode 13.2+ \n- Swift 5.5+  \n\n## Installation\n\n### Swift Package Manager\n\nAdd it as a dependency in a Swift Package, and add it to your Package. Swift:\n\n```swift\ndependencies: [\n  .package(url: \"https://github.com/immobiliare/RealHTTP.git\", from: \"1.0.0\")\n]\n```\n\nAnd add it as a dependency of your target:\n\n```swift\ntargets: [\n  .target(name: \"MyTarget\", dependencies: [\n    .product(name: \"https://github.com/immobiliare/RealHTTP.git\", package: \"RealHTTP\")\n  ])\n]\n```\n\nIn Xcode 11+ you can also navigate to the File menu and choose Swift Packages -\u003e Add Package Dependency..., then enter the repository URL and version details.\n\n### CocoaPods\n\nRealHTTP can be installed with CocoaPods by adding pod 'RealHTTP' to your Podfile.\n\n```ruby\npod 'RealHTTP'\n```\n\n## Powered Apps\n\nThe fantastic mobile team at ImmobiliareLabs created RealHTTP.\nWe are currently using RealHTTP in all of our products.\n\n**If you are using RealHTTP in your app [drop us a message](mailto:mobile@immobiliare.it)**.\n\n## Support \u0026 Contribute\n\nMade with ❤️ by [ImmobiliareLabs](https://github.com/orgs/immobiliare) \u0026 [Contributors](https://github.com/immobiliare/RealHTTP/graphs/contributors)\n\nWe'd love for you to contribute to RealHTTP!  \nIf you have questions about using RealHTTP, bugs, and enhancement, please feel free to reach out by opening a [GitHub Issue](https://github.com/immobiliare/RealHTTP/issues).\n\n\u003ca href=\"http://labs.immobiliare.it\"\u003e\u003cimg src=\"./Documentation/assets/immobiliarelabs.png\" alt=\"ImmobiliareLabs\" width=\"200\"/\u003e\u003c/a\u003e\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fimmobiliare%2Frealhttp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fimmobiliare%2Frealhttp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fimmobiliare%2Frealhttp/lists"}