mirror of
https://github.com/bingohuang/docker-labs.git
synced 2025-07-15 02:37:27 +08:00
23 lines
397 B
Go
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)
|
|
}
|