1
0
mirror of https://github.com/aclindsa/moneygo.git synced 2024-12-26 07:33:21 -05:00

Make sessions PUT and POST return the resulting Session

This commit is contained in:
Aaron Lindsay 2016-10-04 08:40:26 -04:00
parent d5b1260b27
commit 071b7ff1e3

View File

@ -5,6 +5,7 @@ import (
"fmt"
"github.com/gorilla/securecookie"
"github.com/gorilla/sessions"
"log"
"net/http"
)
@ -96,13 +97,18 @@ func SessionHandler(w http.ResponseWriter, r *http.Request) {
DeleteSessionIfExists(r)
_, err = NewSession(w, r, dbuser.UserId)
session, err := NewSession(w, r, dbuser.UserId)
if err != nil {
WriteError(w, 999 /*Internal Error*/)
return
}
WriteSuccess(w)
err = session.Write(w)
if err != nil {
WriteError(w, 999 /*Internal Error*/)
log.Print(err)
return
}
} else if r.Method == "GET" {
s, err := GetSession(r)
if err != nil {