infra/proxyd/backend_test.go

23 lines
355 B
Go
Raw Normal View History

2023-10-20 05:02:12 +03:00
package proxyd
import (
"testing"
2024-06-11 22:34:44 +03:00
"github.com/stretchr/testify/assert"
2023-10-20 05:02:12 +03:00
)
func TestStripXFF(t *testing.T) {
tests := []struct {
in, out string
}{
{"1.2.3, 4.5.6, 7.8.9", "1.2.3"},
{"1.2.3,4.5.6", "1.2.3"},
{" 1.2.3 , 4.5.6 ", "1.2.3"},
}
for _, test := range tests {
actual := stripXFF(test.in)
assert.Equal(t, test.out, actual)
}
}