Skip to content
This repository has been archived by the owner. It is now read-only.
Simplest HTTP GET requester for Go with timeout support
Branch: master
Clone or download
Latest commit 475b1e2 May 6, 2018
Type Name Latest commit message Commit time
Failed to load latest commit information.
vendor/ add: source code and readme Sep 13, 2017


Easy to use API to make timeout supported http GET requests in Go.

Go Report Card Coverage Status

MyHttp 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.

It's battle-tested in production and has tests which even verifies connection leaking issues.

I'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.


go get


See MyHttp GoDoc for the documentation.

Usage example


Get simply gets the url and returns an http.Response.

import (

mh := myhttp.New(time.Second * 10) // timeout after 10 seconds

res, err := mh.Get("")
if err != nil {

// use res here...


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.

import (

mh := myhttp.New(time.Second * 10) // timeout after 10 seconds

err := mh.WrapGet("", func(r *http.Response) error {
	// use res here...
	// MyHttp will automatically close http.Response.Body for you after this func ends.

if err != nil {


Inanc Gumus – @inancgumus

Distributed under the MIT license. See LICENSE for more information.


  1. Fork it (
  2. Create your feature branch (git checkout -b feature/foo)
  3. Commit your changes (git commit -am 'add: foo')
  4. Push to the branch (git push origin feature/foo)
  5. Create a new Pull Request
You can’t perform that action at this time.