Skip to content

Instantly share code, notes, and snippets.

@tmtk75
Last active August 29, 2015 14:02
Show Gist options
  • Save tmtk75/9493a18dcae39b82df28 to your computer and use it in GitHub Desktop.
Save tmtk75/9493a18dcae39b82df28 to your computer and use it in GitHub Desktop.
package main
import (
"fmt"
"io/ioutil"
"net/http"
)
type HttpResponse http.Response
func (self *HttpResponse) Bytes() []byte {
b, _ := ioutil.ReadAll(self.Body)
return b
}
func Get() *HttpResponse {
res, _ := http.Get("http://www.yahoo.co.jp")
r := HttpResponse(*res)
return &r
}
func main() {
fmt.Print(string(Get().Bytes()))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment