{"id":21318362,"url":"https://github.com/mezhevikin/http-request","last_synced_at":"2025-06-27T18:06:12.940Z","repository":{"id":63917859,"uuid":"531000220","full_name":"mezhevikin/http-request","owner":"mezhevikin","description":"🌐 A tiny http client for iOS and macOS. Only 80 lines of code.","archived":false,"fork":false,"pushed_at":"2022-12-30T11:13:36.000Z","size":20,"stargazers_count":30,"open_issues_count":1,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-07T21:16:32.626Z","etag":null,"topics":["alamofire","api","extension","foundation","http","http-client","ios","json","lightweight","macos","networking","nsurlsession","request","response","spm","swift","tiny","urlrequest","urlsession","wrapper"],"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/mezhevikin.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-08-31T08:39:17.000Z","updated_at":"2024-06-29T08:59:20.000Z","dependencies_parsed_at":"2023-01-14T13:45:53.270Z","dependency_job_id":null,"html_url":"https://github.com/mezhevikin/http-request","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/mezhevikin/http-request","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mezhevikin%2Fhttp-request","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mezhevikin%2Fhttp-request/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mezhevikin%2Fhttp-request/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mezhevikin%2Fhttp-request/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mezhevikin","download_url":"https://codeload.github.com/mezhevikin/http-request/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mezhevikin%2Fhttp-request/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262307419,"owners_count":23291071,"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","extension","foundation","http","http-client","ios","json","lightweight","macos","networking","nsurlsession","request","response","spm","swift","tiny","urlrequest","urlsession","wrapper"],"created_at":"2024-11-21T19:12:31.604Z","updated_at":"2025-06-27T18:06:12.909Z","avatar_url":"https://github.com/mezhevikin.png","language":"Swift","readme":"# HttpRequest\n\nA tiny http client for iOS and macOS. Only [80 lines](Sources/HttpRequest/HttpRequest.swift) of code.\n\n### Get\n\n```swift\nlet request = HttpRequest(\n    url: \"https://httpbin.org/get\",\n    parameters: [\"name\": \"Alex\"],\n)\nrequest.json(HttpBin.self) { json, response in\n    print(json)\n}\n```\n\n### Post\n\n```swift\nlet request = HttpRequest(\n    url: \"https://httpbin.org/post\",\n    method: .post,\n    parameters: [\"name\": \"Alex\"],\n    headers: [\"User-Agent\": \"HttpRequest\"]\n)\nrequest.json(HttpBin.self) { json, response in\n    if let json {\n         print(json)\n    } else if let error = response.error {\n        print(error)\n    }\n}\n```\n\n### URLRequest and HTTPURLResponse\n\n```swift\nvar request = HttpRequest(\n    url: \"https://httpbin.org/get\",\n)\nrequest.timeoutInterval = 30\nrequest.cachePolicy = .reloadIgnoringCacheData\nrequest.json(HttpBin.self) { json, response in\n    print(response.original.statusCode)\n    print(response.original.allHeaderFields)\n}\n```\n\n### Json\n\n```swift\nstruct HttpBin: Codable {\n    let args: [String: String]?\n    let form: [String: String]?\n    let headers: [String: String]?\n}\n\nHttpRequest(url: \"https://httpbin.org/get\").json(HttpBin.self) { json, response in\n    print(json)\n}\n```\n\n### Data and String\n\n```swift\nHttpRequest(url: \"https://httpbin.org/get\").data() { data, response in\n    if let data {\n        let string = String(\n            data: data,\n            encoding: .utf8\n        )\n        print(string)\n    }\n}\n\n```\n\n### Swift Package Manager\n\n```\nhttps://github.com/mezhevikin/http-request.git\n```\n\n### CocoaPods\n\n```\npod 'HttpRequest', :git =\u003e 'https://github.com/mezhevikin/http-request.git'\n```\n\n### Links\n\n🌐 [HttpRequest](https://github.com/mezhevikin/http-request-kotlin) for Kotlin/Android\n\n💹 [Best Currency Converter](https://getconverter.org)\n\n☕️ [Buy me a coffee](https://www.buymeacoffee.com/mezhevikin)","funding_links":["https://www.buymeacoffee.com/mezhevikin"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmezhevikin%2Fhttp-request","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmezhevikin%2Fhttp-request","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmezhevikin%2Fhttp-request/lists"}