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) dde49d8700 Initial commit
2016-10-08 03:12:48 +02:00

23 lines
399 B
Go

package handlers
import (
"encoding/json"
"net/http"
"github.com/go-zoo/bone"
"github.com/xetorthio/play-with-docker/services"
)
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)
}