Simple blogging system written in Go https://goblog.app
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

28 lines
447 B

package main
import (
"net/http"
"time"
)
type httpClient interface {
Do(req *http.Request) (*http.Response, error)
}
type appHttpClient struct {
hc *http.Client
}
var _ httpClient = &appHttpClient{}
func (c *appHttpClient) Do(req *http.Request) (*http.Response, error) {
if c.hc == nil {
c.hc = &http.Client{
Timeout: 5 * time.Minute,
Transport: &http.Transport{
DisableKeepAlives: true,
},
}
}
return c.hc.Do(req)
}