1
0
mirror of https://github.com/bingohuang/docker-labs.git synced 2025-07-14 10:17:26 +08:00
docker-labs/handlers/get_session.go
Jonathan Leibiusky (@xetorthio) b6b849e2c6 Change import paths
Add session cleanup
2016-10-08 10:25:10 +02:00

23 lines
397 B
Go

package handlers
import (
"encoding/json"
"net/http"
"github.com/franela/play-with-docker/services"
"github.com/go-zoo/bone"
)
func GetSession(rw http.ResponseWriter, req *http.Request) {
sessionId := bone.GetValue(req, "sessionId")
session := services.GetSession(sessionId)
if session == nil {
rw.WriteHeader(http.StatusNotFound)
return
}
json.NewEncoder(rw).Encode(session)
}