infra/proxyd/backend_test.go
2024-06-11 14:17:04 -05:00

22 lines
354 B
Go

package proxyd
import (
"github.com/stretchr/testify/assert"
"testing"
)
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)
}
}