mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-09-30 19:22:08 +00:00
make outgoing timeout configurable for tests
This commit is contained in:
parent
89b4c478f6
commit
ecd2016a0e
1 changed files with 6 additions and 1 deletions
|
@ -66,6 +66,11 @@ type ClientFactory struct {
|
|||
|
||||
// NewClient function
|
||||
func NewClientFactory() (c *ClientFactory, err error) {
|
||||
return NewClientFactoryWithTimeout(5 * time.Second)
|
||||
}
|
||||
|
||||
// NewClient function
|
||||
func NewClientFactoryWithTimeout(timeout time.Duration) (c *ClientFactory, err error) {
|
||||
if err = containsRequiredHTTPHeaders(http.MethodGet, setting.Federation.GetHeaders); err != nil {
|
||||
return nil, err
|
||||
} else if err = containsRequiredHTTPHeaders(http.MethodPost, setting.Federation.PostHeaders); err != nil {
|
||||
|
@ -77,7 +82,7 @@ func NewClientFactory() (c *ClientFactory, err error) {
|
|||
Transport: &http.Transport{
|
||||
Proxy: proxy.Proxy(),
|
||||
},
|
||||
Timeout: 5 * time.Second,
|
||||
Timeout: timeout,
|
||||
},
|
||||
algs: setting.HttpsigAlgs,
|
||||
digestAlg: httpsig.DigestAlgorithm(setting.Federation.DigestAlgorithm),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue