{"id":13764066,"url":"https://github.com/inancgumus/myhttp","last_synced_at":"2025-05-10T17:31:31.985Z","repository":{"id":57496975,"uuid":"103419563","full_name":"inancgumus/myhttp","owner":"inancgumus","description":"Simplest HTTP GET requester for Go with timeout support","archived":true,"fork":false,"pushed_at":"2018-05-06T18:25:10.000Z","size":126,"stargazers_count":34,"open_issues_count":1,"forks_count":14,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-11-16T23:32:33.624Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/inancgumus.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":"2017-09-13T15:48:47.000Z","updated_at":"2023-12-27T19:22:25.000Z","dependencies_parsed_at":"2022-09-03T23:20:37.747Z","dependency_job_id":null,"html_url":"https://github.com/inancgumus/myhttp","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/inancgumus%2Fmyhttp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/inancgumus%2Fmyhttp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/inancgumus%2Fmyhttp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/inancgumus%2Fmyhttp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/inancgumus","download_url":"https://codeload.github.com/inancgumus/myhttp/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253453322,"owners_count":21911077,"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":[],"created_at":"2024-08-03T15:01:11.747Z","updated_at":"2025-05-10T17:31:31.441Z","avatar_url":"https://github.com/inancgumus.png","language":"Go","readme":"# MyHttp\n\u003e Easy to use API to make timeout supported http GET requests in Go.\n\n![Go Report Card](https://goreportcard.com/badge/github.com/inancgumus/myhttp) [![Coverage Status](https://coveralls.io/repos/github/inancgumus/myhttp/badge.svg?branch=master)](https://coveralls.io/github/inancgumus/myhttp?branch=master)\n\nMyHttp is for coders who don't want to write timeout support logic and don't want to deal with heavy APIs, just to make http GET request in Go.\n\nIt's battle-tested in production and has tests which even verifies connection leaking issues.\n\nI'd been dealing with this issue myself, I read many documents, and saw that there are no simple and lightweight APIs to do http GET request with timeout logic. So, I created MyHttp in one of my projects and wanted to move it here.\n\n## Installation\n\n```sh\ngo get github.com/inancgumus/myhttp\n```\n\n## Documentation\n\nSee [MyHttp GoDoc](https://godoc.org/github.com/inancgumus/myhttp) for the documentation.\n\n## Usage example\n\n### Get\n\n`Get` simply gets the url and returns an `http.Response`.\n\n```go\nimport (\n\t\"time\"\n\t\"github.com/inancgumus/myhttp\"\n)\n\nmh := myhttp.New(time.Second * 10) // timeout after 10 seconds\n\nres, err := mh.Get(\"http://www.domain.com/foo\")\nif err != nil {\n\tpanic(err)\n}\n\n// use res here...\n```\n\n### WrapGet\n\n`WrapGet` accepts a function in its second argument and runs it after getting the `http.Response` from the url and automatically closes the http.Response.Body, in case you may forget to close it.\n\n```go\nimport (\n\t\"time\"\n\t\"github.com/inancgumus/myhttp\"\n)\n\nmh := myhttp.New(time.Second * 10) // timeout after 10 seconds\n\nerr := mh.WrapGet(\"http://www.domain.com/foo\", func(r *http.Response) error {\n\t// use res here...\n\t// MyHttp will automatically close http.Response.Body for you after this func ends.\n})\n\nif err != nil {\n\tpanic(err)\n}\n```\n\n## Author\n\nInanc Gumus – [@inancgumus](https://twitter.com/inancgumus)\n\nDistributed under the MIT license. See ``LICENSE`` for more information.\n\n## Contributing\n\n1. Fork it (\u003chttps://github.com/inancgumus/myhttp/fork\u003e)\n2. Create your feature branch (`git checkout -b feature/foo`)\n3. Commit your changes (`git commit -am 'add: foo'`)\n4. Push to the branch (`git push origin feature/foo`)\n5. Create a new Pull Request\n","funding_links":[],"categories":["工具库","Utilities","公用事业公司","实用工具","工具库`可以提升效率的通用代码库和工具`","Utility"],"sub_categories":["查询语","Utility/Miscellaneous","HTTP Clients","Advanced Console UIs","交流","实用程序/Miscellaneous","\u003cspan id=\"高级控制台用户界面-advanced-console-uis\"\u003e高级控制台用户界面 Advanced Console UIs\u003c/span\u003e","Fail injection"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Financgumus%2Fmyhttp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Financgumus%2Fmyhttp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Financgumus%2Fmyhttp/lists"}