1
0
mirror of https://github.com/bingohuang/docker-labs.git synced 2025-07-14 01:57:32 +08:00
docker-labs/handlers/get_session.go
2017-05-08 15:35:42 -03:00

24 lines
415 B
Go

package handlers
import (
"encoding/json"
"net/http"
"github.com/gorilla/mux"
"github.com/play-with-docker/play-with-docker/services"
)
func GetSession(rw http.ResponseWriter, req *http.Request) {
vars := mux.Vars(req)
sessionId := vars["sessionId"]
session := services.GetSession(sessionId)
if session == nil {
rw.WriteHeader(http.StatusNotFound)
return
}
json.NewEncoder(rw).Encode(session)
}