{"id":18895292,"url":"https://github.com/carllosnc/hty","last_synced_at":"2026-05-15T22:31:14.490Z","repository":{"id":202569131,"uuid":"707482798","full_name":"carllosnc/hty","owner":"carllosnc","description":"Tiny HTTP Wrapper","archived":false,"fork":false,"pushed_at":"2024-06-16T23:34:38.000Z","size":39,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-24T06:37:55.715Z","etag":null,"topics":["dart","http"],"latest_commit_sha":null,"homepage":"","language":"Dart","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/carllosnc.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"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":"2023-10-20T02:09:54.000Z","updated_at":"2024-06-16T23:34:41.000Z","dependencies_parsed_at":null,"dependency_job_id":"b8f37813-ab43-4f41-9205-bce54f0c39f3","html_url":"https://github.com/carllosnc/hty","commit_stats":null,"previous_names":["c4co/hty","carllosnc/hty"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/carllosnc/hty","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/carllosnc%2Fhty","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/carllosnc%2Fhty/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/carllosnc%2Fhty/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/carllosnc%2Fhty/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/carllosnc","download_url":"https://codeload.github.com/carllosnc/hty/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/carllosnc%2Fhty/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278708035,"owners_count":26031932,"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","status":"online","status_checked_at":"2025-10-06T02:00:05.630Z","response_time":65,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["dart","http"],"created_at":"2024-11-08T08:27:30.281Z","updated_at":"2025-10-07T01:48:48.728Z","avatar_url":"https://github.com/carllosnc.png","language":"Dart","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Hty\n\n\u003eTiny http wrapper\n\n[![Hty](https://github.com/carllosnc/hty/actions/workflows/dart.yml/badge.svg)](https://github.com/carllosnc/hty/actions/workflows/dart.yml)\n[![Codacy Badge](https://app.codacy.com/project/badge/Grade/634f7a5dec9e44d19e2850e872ab24eb)](https://app.codacy.com/gh/carllosnc/hty/dashboard?utm_source=gh\u0026utm_medium=referral\u0026utm_content=\u0026utm_campaign=Badge_grade)\n\n## Install\n\n```yaml\ndependencies:\n  hty:\n    git:\n      url: https://github.com/carllosnc/hty.git\n```\n\nExample:\n\n```dart\nimport 'package:hty/hty.dart';\nimport 'package:http/http.dart' as http;\n\nvoid main(){\n  var hty = Hty(\n    baseurl: 'https://jsonplaceholder.typicode.com',\n    client: http.Client(),\n    defaultHeaders: {\n      'Accept': 'application/json',\n    },\n  );\n\n  var result = await hty.get(\n    path: \"/todos\",\n  );\n\n  hty.close();\n}\n```\n\n## Hty()\n\n`hty` is a class that provides a set of methods for sending HTTP requests and handling responses.\n\n```dart\nvar hty = Hty(\n  baseurl: 'https://jsonplaceholder.typicode.com',\n  client: http.Client(),\n  defaultHeaders: {\n    'Accept': 'application/json',\n  },\n);\n```\n\n| Parameter        | Type                  | Description                                |\n| ---------------- | --------------------- | ------------------------------------------ |\n| `baseurl`        | `String`              | Base URL for requests                      |\n| `client`         | `http.Client`         | HTTP Client                                |\n| `defaultHeaders` | `Map\u003cString, String\u003e` | Headers that will be used on every request |\n\n## hty.get()\n\n`hty.get` is a method that sends a GET request to the specified path.\n\n```dart\nvar reponse = await hty.get(\n  path: \"/todos\",\n);\n```\n\n| Parameter | Type                    | Description                          |\n| --------- | ----------------------- | ------------------------------------ |\n| `path`    | `String`                | Path to resource                     |\n| `query`   | `Map\u003cString, dynamic\u003e?` | Query params                         |\n| `headers` | `Map\u003cString, dynamic\u003e?` | Specific headers for current request |\n| `cache`   | `bool`                  | Memory cache, default is `true`      |\n\n\u003e [!NOTE]\n\u003e Memory cache: If the same request is made twice, the second request will be returned from memory.\n\n## hty.post()\n\n`hty.post` is a method that sends a POST request to the specified path.\n\n```dart\nvar reponse = await hty.post(\n  path: \"/todos\",\n  payload: {\n    'title': 'todo title',\n    'content': 'todo content',\n  },\n);\n```\n\n| Parameter  | Type                    | Description                          |\n| ---------- | ----------------------- | ------------------------------------ |\n| `path`     | `String`                | Path to resource                     |\n| `headers`  | `Map\u003cString, dynamic\u003e?` | Specific headers for current request |\n| `payload`  | `Map\u003cString, string\u003e?`  | Request body                         |\n| `encoding` | `Enconding`             | Default is `utf-8`                   |\n\n## hty.put()\n\n`hty.put` is a method that sends a PUT request to the specified path.\n\n```dart\nvar reponse = await hty.put(\n  path: \"/todos/1\",\n  payload: {\n    'title': 'todo title',\n    'content': 'todo content',\n  },\n);\n```\n\n| Parameter  | Type                    | Description                          |\n| ---------- | ----------------------- | ------------------------------------ |\n| `path`     | `String`                | Path to resource                     |\n| `headers`  | `Map\u003cString, dynamic\u003e?` | Specific headers for current request |\n| `payload`  | `Map\u003cString, string\u003e?`  | Request body                         |\n| `encoding` | `Enconding`             | Default is `utf-8`                   |\n\n## hty.delete()\n\n`hty.delete` is a method that sends a DELETE request to the specified path.\n\n```dart\nvar reponse = await hty.delete(\n  path: \"/todos/1\",\n);\n```\n\n## HtyGetResponse\n\n`htyGetResponse` is a class that contains the response from a GET request.\n\n| Parameter         | Type                   | Description                    |\n| ----------------- | ---------------------- | ------------------------------ |\n| `statusCode`      | `int`                  | HTTP status code               |\n| `responseHeaders` | `Map\u003cString, string\u003e?` | Response headers               |\n| `requestHeaders`  | `Map\u003cString, string\u003e?` | Request headers                |\n| `data`            | `dynamic`              | Request data                   |\n| `response`        | `http.Response`        | Full response from HTTP object |\n| `message`         | `String`               | HTTP message                   |\n\n## HtyPostResponse\n\n`htyPostResponse` is a class that contains the response from a POST request.\n\n| Parameter         | Type                   | Description                    |\n| ----------------- | ---------------------- | ------------------------------ |\n| `statusCode`      | `int`                  | HTTP status code               |\n| `responseHeaders` | `Map\u003cString, string\u003e?` | Response headers               |\n| `requestHeaders`  | `Map\u003cString, string\u003e?` | Request headers                |\n| `data`            | `dynamic`              | Request data                   |\n| `response`        | `http.Response`        | Full response from HTTP object |\n| `message`         | `String`               | HTTP message                   |\n| `payload`         | `Map\u003cString, string\u003e?` | Request body                   |\n\n## HtyException\n\n`htyException` is a class that contains information about an error that occurred during a request.\n\n```dart\ntry {\n  await hty.post(\n    path: '/posts',\n    payload: {\n      'title': 'title',\n      'body': 'content',\n      'userId': '1',\n    },\n  );\n} on HtyException catch (e) {\n  print(e.message);\n  print(e.statusCode);\n  print(e.description);\n}\n```\n\n| Parameter     | Type                              | Description           |\n| ------------- | --------------------------------- | --------------------- |\n| `statusCode`  | `int`                             | HTTP status code      |\n| `message`     | `String`                          | Error message         |\n| `description` | `Map\u003cString, String\u003e` or `String` | Api error description |\n\n## Development\n\n**Start server:**\nthe web server run with dart frog: https://dartfrog.vgv.dev/\n```bash\n  cd server\n  dart_frog serve\n```\n\n**Run tests:**\n```bash\n  dart test\n```\n---\n\nCarlos Costa @ 2023\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcarllosnc%2Fhty","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcarllosnc%2Fhty","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcarllosnc%2Fhty/lists"}