github.com/gogf/gf@v1.16.9/net/ghttp/ghttp_server_config_cookie.go (about)

     1  // Copyright GoFrame Author(https://goframe.org). All Rights Reserved.
     2  //
     3  // This Source Code Form is subject to the terms of the MIT License.
     4  // If a copy of the MIT was not distributed with this file,
     5  // You can obtain one at https://github.com/gogf/gf.
     6  
     7  package ghttp
     8  
     9  import (
    10  	"time"
    11  )
    12  
    13  // SetCookieMaxAge sets the CookieMaxAge for server.
    14  func (s *Server) SetCookieMaxAge(ttl time.Duration) {
    15  	s.config.CookieMaxAge = ttl
    16  }
    17  
    18  // SetCookiePath sets the CookiePath for server.
    19  func (s *Server) SetCookiePath(path string) {
    20  	s.config.CookiePath = path
    21  }
    22  
    23  // SetCookieDomain sets the CookieDomain for server.
    24  func (s *Server) SetCookieDomain(domain string) {
    25  	s.config.CookieDomain = domain
    26  }
    27  
    28  // GetCookieMaxAge returns the CookieMaxAge of server.
    29  func (s *Server) GetCookieMaxAge() time.Duration {
    30  	return s.config.CookieMaxAge
    31  }
    32  
    33  // GetCookiePath returns the CookiePath of server.
    34  func (s *Server) GetCookiePath() string {
    35  	return s.config.CookiePath
    36  }
    37  
    38  // GetCookieDomain returns CookieDomain of server.
    39  func (s *Server) GetCookieDomain() string {
    40  	return s.config.CookieDomain
    41  }