mirror of
https://github.com/go-micro/go-micro.git
synced 2025-11-29 21:47:44 +02:00
First
This commit is contained in:
25
server/server_request.go
Normal file
25
server/server_request.go
Normal file
@@ -0,0 +1,25 @@
|
||||
package server
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
)
|
||||
|
||||
type serverRequest struct {
|
||||
req *http.Request
|
||||
}
|
||||
|
||||
func (s *serverRequest) Headers() Headers {
|
||||
return s.req.Header
|
||||
}
|
||||
|
||||
func (s *serverRequest) Session(name string) string {
|
||||
if sess := s.Headers().Get(name); len(sess) > 0 {
|
||||
return sess
|
||||
}
|
||||
|
||||
c, err := s.req.Cookie(name)
|
||||
if err != nil {
|
||||
return ""
|
||||
}
|
||||
return c.Value
|
||||
}
|
||||
Reference in New Issue
Block a user