github.com/argoproj/argo-cd@v1.8.7/util/http/http_test.go (about)

     1  package http
     2  
     3  import (
     4  	"strings"
     5  	"testing"
     6  
     7  	"github.com/stretchr/testify/assert"
     8  )
     9  
    10  func TestCookieMaxLength(t *testing.T) {
    11  
    12  	cookie, err := MakeCookieMetadata("foo", "bar")
    13  	assert.NoError(t, err)
    14  	assert.Equal(t, "foo=bar", cookie)
    15  
    16  	cookie, err = MakeCookieMetadata("foo", strings.Repeat("_", 4093-3))
    17  	assert.EqualError(t, err, "invalid cookie, at 4094 long it is longer than the max length of 4093")
    18  	assert.Equal(t, "", cookie)
    19  }