geziyor/middleware/duplicate_requests_test.go
Administrator 688c516c9f 初始化
2024-09-04 16:48:42 +08:00

23 lines
675 B
Go

package middleware
import (
"github.com/stretchr/testify/assert"
"softdown.com/shusou/geziyor/client"
"strings"
"testing"
)
func TestDuplicateRequests_ProcessRequest(t *testing.T) {
longURL := "https://example.com" + strings.Repeat("/path", 50)
req, err := client.NewRequest("GET", longURL, nil)
assert.NoError(t, err)
req2, err := client.NewRequest("GET", longURL, nil)
assert.NoError(t, err)
duplicateRequestsProcessor := DuplicateRequests{RevisitEnabled: false}
duplicateRequestsProcessor.ProcessRequest(req)
duplicateRequestsProcessor.ProcessRequest(req2)
duplicateRequestsProcessor.ProcessRequest(req2)
duplicateRequestsProcessor.ProcessRequest(req2)
}