31 lines
		
	
	
		
			561 B
		
	
	
	
		
			Go
		
	
	
	
			
		
		
	
	
			31 lines
		
	
	
		
			561 B
		
	
	
	
		
			Go
		
	
	
	
package cookie
 | 
						|
 | 
						|
import (
 | 
						|
	"net/http"
 | 
						|
	"testing"
 | 
						|
	"time"
 | 
						|
 | 
						|
	"github.com/stretchr/testify/assert"
 | 
						|
)
 | 
						|
 | 
						|
func Test_copyCookie(t *testing.T) {
 | 
						|
	expire, _ := time.Parse(time.RFC3339, "2020-03-17T00:00:00Z")
 | 
						|
	c := &http.Cookie{
 | 
						|
		Name:       "name",
 | 
						|
		Value:      "value",
 | 
						|
		Path:       "/path",
 | 
						|
		Domain:     "x.y.z",
 | 
						|
		Expires:    expire,
 | 
						|
		RawExpires: "rawExpire",
 | 
						|
		MaxAge:     1,
 | 
						|
		Secure:     true,
 | 
						|
		HttpOnly:   true,
 | 
						|
		Raw:        "raw",
 | 
						|
		Unparsed:   []string{"unparsed"},
 | 
						|
		SameSite:   http.SameSiteLaxMode,
 | 
						|
	}
 | 
						|
 | 
						|
	got := copyCookie(c)
 | 
						|
	assert.Equal(t, c, got)
 | 
						|
}
 |