{"id":16622864,"url":"https://github.com/lucasgmagalhaes/lightrest","last_synced_at":"2026-04-25T09:05:00.500Z","repository":{"id":49811223,"uuid":"518099776","full_name":"lucasgmagalhaes/lightRest","owner":"lucasgmagalhaes","description":"Lightweight wrapper for dotnet's httpClient","archived":false,"fork":false,"pushed_at":"2022-11-16T13:01:02.000Z","size":11688,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-11T09:53:22.296Z","etag":null,"topics":["dotnet-core","http","rest"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lucasgmagalhaes.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-07-26T14:41:03.000Z","updated_at":"2023-03-04T04:19:49.000Z","dependencies_parsed_at":"2023-01-22T06:46:03.319Z","dependency_job_id":null,"html_url":"https://github.com/lucasgmagalhaes/lightRest","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/lucasgmagalhaes/lightRest","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lucasgmagalhaes%2FlightRest","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lucasgmagalhaes%2FlightRest/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lucasgmagalhaes%2FlightRest/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lucasgmagalhaes%2FlightRest/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lucasgmagalhaes","download_url":"https://codeload.github.com/lucasgmagalhaes/lightRest/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lucasgmagalhaes%2FlightRest/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32256221,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-25T04:23:17.126Z","status":"ssl_error","status_checked_at":"2026-04-25T04:21:53.360Z","response_time":59,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["dotnet-core","http","rest"],"created_at":"2024-10-12T03:04:05.747Z","updated_at":"2026-04-25T09:05:00.480Z","avatar_url":"https://github.com/lucasgmagalhaes.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# LightRest\n\n[![.NET](https://github.com/lucasgmagalhaes/lightRest/actions/workflows/dotnet.yml/badge.svg)](https://github.com/lucasgmagalhaes/lightRest/actions/workflows/dotnet.yml)\n\n## Motivation\n\nThis lib is indeed to be a lightweight alternative for RestSharp. It **DOES NOT** intend to be a directly\nconcurrent of RestSharp. Only to be an possible alternative for simple scenarios. This way, do not \nexpect great features or treatments in this lib, only a simple, request-response with serialization/deserialization\nof provided parameters and a HttpCode return.\n\n\n## Goal\n\nThe project goal is to proportionate a wrapper for the well known `HttpClient` and as light as possible. The response of all requests \nare a tuple with the response (as `string` or serialized in a given type), and the HttpStatusCode. To reduce in maximum the memory allocation \nmade.\n\n\n## Features\n\nAll http methods has both `async` and `sync` versions. They include:\n\n- `POST`\n- `GET`\n- `PUT`\n- `HEAD`\n- `DELETE`\n- `PATCH`\n\nIn each method, can be passed a pure URL, with a given body (or not), or can be passed using\nthe class `HttpRequest`. \n\n## Benchmark\n\nAs mentioned, the goal of this library is only to be a lightweight version of the amazing RestSharp lib\nand to encapsulate the native class `HttpClient` that the .NET already has.\n\nThe benchmark was made comparing `RestSharp` and the `HttpClient` itself.\nBut the `HttpClient` used an \"common\" implementation for data fetch that is \nmostly used in applications. The implementation isn't equal to the one made by `LightRest`. It was done intensionally to show how even a \"default\" usage of the `HttpClient` can be improved.\n\nThe print above shows the implementation used for `HttpClient`:\n\n\u003cdiv align=\"center\"\u003e\n  \u003cbr /\u003e\n  \u003cp\u003e\n    \u003cimg width=\"600\" height=\"300\" src=\"https://github.com/lucasgmagalhaes/lightRest/blob/70b1e349bb2b5564d33efa2659d0f384c92f2d27/assets/http_benchmark_code.png\" /\u003e\n  \u003c/p\u003e\n\u003c/div\u003e\n\nAll tests were made with the following configs:\n\n``` ini\n\nBenchmarkDotNet=v0.13.1, OS=Windows 10.0.22000\nAMD Ryzen 5 2600, 1 CPU, 12 logical and 6 physical cores\n.NET SDK=6.0.401\n  [Host]     : .NET 6.0.9 (6.0.922.41905), X64 RyuJIT\n  DefaultJob : .NET 6.0.9 (6.0.922.41905), X64 RyuJIT\n\n```\n|     Method | Count |     Mean |     Error |    StdDev |    Gen 0 |    Gen 1 |    Gen 2 | Allocated |\n|----------- |------ |---------:|----------:|----------:|---------:|---------:|---------:|----------:|\n| **HttpClient** |     **1** | **1.292 ms** | **0.0337 ms** | **0.0967 ms** |        **-** |        **-** |        **-** |      **4 KB** |\n|  LightRest |     1 | 1.235 ms | 0.0243 ms | 0.0307 ms |        - |        - |        - |      4 KB |\n|  RestSharp |     1 | 1.330 ms | 0.0264 ms | 0.0396 ms |   9.7656 |        - |        - |     34 KB |\n| **HttpClient** |    **10** | **1.288 ms** | **0.0254 ms** | **0.0402 ms** |        **-** |        **-** |        **-** |      **8 KB** |\n|  LightRest |    10 | 1.249 ms | 0.0243 ms | 0.0250 ms |        - |        - |        - |      5 KB |\n|  RestSharp |    10 | 1.401 ms | 0.0275 ms | 0.0385 ms |   9.7656 |        - |        - |     41 KB |\n| **HttpClient** |   **100** | **1.725 ms** | **0.0342 ms** | **0.0562 ms** |  **15.6250** |        **-** |        **-** |     **64 KB** |\n|  LightRest |   100 | 1.707 ms | 0.0336 ms | 0.0493 ms |   3.9063 |        - |        - |     20 KB |\n|  RestSharp |   100 | 1.791 ms | 0.0310 ms | 0.0380 ms |  35.1563 |   3.9063 |        - |    143 KB |\n| **HttpClient** |  **1000** | **5.152 ms** | **0.1005 ms** | **0.1535 ms** | **132.8125** |  **85.9375** |  **70.3125** |    **574 KB** |\n|  LightRest |  1000 | 4.298 ms | 0.0836 ms | 0.1350 ms |  31.2500 |   7.8125 |        - |    157 KB |\n|  RestSharp |  1000 | 5.518 ms | 0.1048 ms | 0.1207 ms | 273.4375 | 164.0625 | 125.0000 |  1,104 KB |\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flucasgmagalhaes%2Flightrest","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flucasgmagalhaes%2Flightrest","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flucasgmagalhaes%2Flightrest/lists"}