Read session UUID from cookie if header is missing. Bump to v0.2.14
This commit is contained in:
parent
aecafc2986
commit
452a109204
7
pkg.go
7
pkg.go
@ -64,7 +64,7 @@ import (
|
||||
"strings"
|
||||
)
|
||||
|
||||
const VERSION = "v0.2.13"
|
||||
const VERSION = "v0.2.14"
|
||||
|
||||
type HttpHandler func(http.ResponseWriter, *http.Request)
|
||||
|
||||
@ -376,6 +376,11 @@ func sessionUUID(r *http.Request) (string, error) { // {{{
|
||||
headers := r.Header["X-Session-Id"]
|
||||
if len(headers) > 0 {
|
||||
return headers[0], nil
|
||||
} else {
|
||||
cookie, err := r.Cookie("X-Session-ID")
|
||||
if err == nil && cookie.Value != "" {
|
||||
return cookie.Value, nil
|
||||
}
|
||||
}
|
||||
return "", errors.New("Invalid session")
|
||||
} // }}}
|
||||
|
Loading…
Reference in New Issue
Block a user