Stress test the HTTP(S) server

This commit is contained in:
Jakob Borg
2014-09-17 17:11:53 +02:00
parent 384c543ab9
commit c07b39e58b
2 changed files with 106 additions and 1 deletions

View File

@@ -81,6 +81,9 @@ func (p *syncthingProcess) stop() {
}
func (p *syncthingProcess) get(path string) (*http.Response, error) {
client := &http.Client{
Timeout: 2 * time.Second,
}
req, err := http.NewRequest("GET", fmt.Sprintf("http://127.0.0.1:%d%s", p.port, path), nil)
if err != nil {
return nil, err
@@ -91,7 +94,7 @@ func (p *syncthingProcess) get(path string) (*http.Response, error) {
if p.csrfToken != "" {
req.Header.Add("X-CSRF-Token", p.csrfToken)
}
resp, err := http.DefaultClient.Do(req)
resp, err := client.Do(req)
if err != nil {
return nil, err
}