Skip certificate validation for HTTPS requests
This commit is contained in:
@@ -3,6 +3,7 @@ package vegeta
|
||||
import (
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"strings"
|
||||
"sync/atomic"
|
||||
"testing"
|
||||
"time"
|
||||
@@ -22,3 +23,16 @@ func TestAttackRate(t *testing.T) {
|
||||
t.Fatalf("Wrong number of hits: want %d, got %d\n", rate, hits)
|
||||
}
|
||||
}
|
||||
|
||||
func TestClientCertConfig(t *testing.T) {
|
||||
server := httptest.NewTLSServer(
|
||||
http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {}),
|
||||
)
|
||||
request, _ := http.NewRequest("GET", server.URL, nil)
|
||||
results := make(chan Result, 1)
|
||||
hit(request, results)
|
||||
result := <-results
|
||||
if strings.Contains(result.Error, "x509: certificate signed by unknown authority") {
|
||||
t.Errorf("Invalid certificates should be ignored: Got `%s`", result.Error)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user