Copyright 2020 The Go Authors. All rights reserved. Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
Package cookie is used to get and set HTTP cookies.
package cookie

import (
	
	
	
	

	
)
AlternativeModuleFlash indicates the alternative module path that a request was redirected from.
const AlternativeModuleFlash = "tmp-redirected-from-alternative-module"
Extract returns the value of the cookie at name and deletes the cookie.
func ( http.ResponseWriter,  *http.Request,  string) ( string,  error) {
	defer derrors.Wrap(&, "Extract")
	,  := .Cookie()
	if  != nil &&  != http.ErrNoCookie {
		return "", fmt.Errorf("r.Cookie(%q): %v", , )
	}
	if  == nil {
		return "", nil
	}
	,  := Base64Value()
	if  != nil {
		return "", 
	}
	http.SetCookie(, &http.Cookie{
		Name:    ,
		Path:    .URL.Path,
		Expires: time.Unix(0, 0),
	})
	return , nil
}
Base64Value decodes the value of c using the Base64 URL encoding and returns it as a string.
func ( *http.Cookie) (string, error) {
	,  := base64.URLEncoding.DecodeString(.Value)
	if  != nil {
		return "", 
	}
	return string(), nil
}
Set sets a cookie at the urlPath with name and val.
func ( http.ResponseWriter, , ,  string) {
	 := base64.URLEncoding.EncodeToString([]byte())
	http.SetCookie(, &http.Cookie{Name: , Value: , Path: })