mirror of https://github.com/jlelse/GoBlog
24 lines
347 B
Go
24 lines
347 B
Go
package main
|
|
|
|
import (
|
|
"net/http"
|
|
"time"
|
|
)
|
|
|
|
type httpClient interface {
|
|
Do(req *http.Request) (*http.Response, error)
|
|
}
|
|
|
|
func getHTTPClient() httpClient {
|
|
return &http.Client{
|
|
Timeout: 5 * time.Minute,
|
|
Transport: &http.Transport{
|
|
DisableKeepAlives: true,
|
|
},
|
|
}
|
|
}
|
|
|
|
func (a *goBlog) initHTTPClient() {
|
|
a.httpClient = getHTTPClient()
|
|
}
|