mirror of
https://github.com/skyle1995/NetworkAuth.git
synced 2026-05-25 02:24:05 +08:00
移除验证码调试日志,增加cookie 工具
This commit is contained in:
@@ -2,6 +2,7 @@ package utils
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
@@ -9,6 +10,20 @@ import (
|
||||
// Cookie创建函数
|
||||
// ============================================================================
|
||||
|
||||
// FormatCookies formats a slice of cookies into a string suitable for HTTP headers
|
||||
func FormatCookies(cookies []*http.Cookie) string {
|
||||
var b strings.Builder
|
||||
for i, c := range cookies {
|
||||
if i > 0 {
|
||||
b.WriteString("; ")
|
||||
}
|
||||
b.WriteString(c.Name)
|
||||
b.WriteRune('=')
|
||||
b.WriteString(c.Value)
|
||||
}
|
||||
return b.String()
|
||||
}
|
||||
|
||||
// CreateSecureCookie 创建安全的Cookie
|
||||
// name: Cookie名称
|
||||
// value: Cookie值
|
||||
|
||||
Reference in New Issue
Block a user