{"id":39006035,"url":"https://github.com/thecsw/haruhi","last_synced_at":"2026-01-17T17:17:09.969Z","repository":{"id":65833519,"uuid":"600560430","full_name":"thecsw/haruhi","owner":"thecsw","description":"GO HTTP from SOS Brigade 🐰","archived":false,"fork":false,"pushed_at":"2023-11-28T04:52:34.000Z","size":744,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2023-11-28T05:34:22.391Z","etag":null,"topics":["go","golang","http","http-client"],"latest_commit_sha":null,"homepage":"https://sandyuraz.com/projects/haruhi","language":"Go","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/thecsw.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,"governance":null}},"created_at":"2023-02-11T21:35:25.000Z","updated_at":"2023-03-21T22:12:11.000Z","dependencies_parsed_at":"2023-11-28T05:42:58.398Z","dependency_job_id":null,"html_url":"https://github.com/thecsw/haruhi","commit_stats":null,"previous_names":[],"tags_count":4,"template":null,"template_full_name":null,"purl":"pkg:github/thecsw/haruhi","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thecsw%2Fharuhi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thecsw%2Fharuhi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thecsw%2Fharuhi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thecsw%2Fharuhi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/thecsw","download_url":"https://codeload.github.com/thecsw/haruhi/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thecsw%2Fharuhi/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28512277,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-17T13:38:16.342Z","status":"ssl_error","status_checked_at":"2026-01-17T13:37:44.060Z","response_time":85,"last_error":"SSL_read: 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":["go","golang","http","http-client"],"created_at":"2026-01-17T17:17:09.828Z","updated_at":"2026-01-17T17:17:09.928Z","avatar_url":"https://github.com/thecsw.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# haruhi\n\nWelcome! This is Sandy's take on making a simple yet powerful enough\nHTTP library. Inspired by [python's requests](https://github.com/psf/requests).\n\n\u003cdiv align='center'\u003e\n\n![haruhi](haruhi.gif)\n\n\u003c/div\u003e\n\n## Motivation\n\nWhen it comes to making network requests, I find myself writing a lot of repetitive\ngo code, you know the gist of getting a json response,\n\n```go\nreq, err := http.NewRequestWithContext(context, method, URLpath, body)\nif err != nil { ... }\n\nparams := req.URL.Query()\nparams.Add(key, value)\n// more great parameters you need\nreq.URL.RawQuery = params.Encode()\n\nresp, err := client.Do(req)\nif err != nil { ... }\ndefer resp.Body.Close()\n\n// do a response status check if needed...\n\nans := \u0026SomeStruct{}\nif err != json.NewDecoder(resp.Body).Decode(ans); err != nil { ... }\n\n// whatever other magic you need to do\n```\n\nThis is still a condensed version! The example above skips a couple of steps for brevity,\nlike setting timeouts, deadlines, proper reading, buffering, progress, etc. \n\nYou can end up making something of your own, but repeating the same code has many issues,\nsuch as forgetting to close the response body or set proper contexts with plenty more.\n\n## Examples\n\nWhat if instead, all you had to write was\n\n```go\nans := \u0026SomeStruct{}\nerr := haruhi.URL(URLpath).\n    Method(method).\n    Params(params).\n    Body(body).\n    Timeout(time.Minute).\n    ResponseJSON(ans)\n```\n\nand it did everything for you? You can even simplify it with haruhi's sensible defaults, such as\nrunning a `GET` request by default, etc, so you could even do\n\n```go\nrespStr, err := haruhi.URL(url).Get()\n```\n\nHaruhi of course, supports more funtionality that is aimed to be simple and straight-forward.\nEntire codebase is documented, so head on to [go docs](https://pkg.go.dev/github.com/thecsw/haruhi)\nto see what else she can do. \n\nBad inputs, like setting handlers to `nil` will be ignored. Fatal errors when creating a request\nthrough Go or serializing bodies will be called with `log.Fatalf`.\n\nHave fun requesting!\n\n## Similar projects\n\nThere is a golang [requests](https://github.com/carlmjohnson/requests) project by Carl M. Johnson,\nwho wrote a nice [blog post](https://blog.carlmjohnson.net/post/2021/requests-golang-http-client/) \nabout needing a nice http library to avoid many of mistakes mentioned above. It has been around for\nmuch longer (around 2 years?) and I've tried to use it. However, it may have been me misreading \nmethods, or something else, but my requests weren't passing as I expected them to. And it's a powerful\nlibrary, which can do roundtrip logging, redirect checkers, etc. However, most of the time, I want\na dead-simple interface that \"just works\" and stays close to how I make fully proper go requests. \nAlmost as if it's a bunch of macros.\n\nI also found an older [requests library](https://github.com/asmcos/requests), which I've never used\nbut wanted to mention nonetheless.\n\n## Why Haruhi?\n\nBecause [Endless Eight is a cinematic masterpiece](https://letterboxd.com/thecsw/film/the-melancholy-of-haruhi-suzumiya/) and [Haruhi is life itself](https://haruhi.fandom.com/wiki/Haruhi_Suzumiya).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthecsw%2Fharuhi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthecsw%2Fharuhi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthecsw%2Fharuhi/lists"}