1
0
mirror of https://github.com/bingohuang/docker-labs.git synced 2025-10-04 17:33:21 +08:00

Add CORS handlers to support SDK

This commit is contained in:
Marcos Lilljedahl
2017-01-13 19:29:39 -03:00
parent c1cfc7958a
commit 4616cb1f5d
2 changed files with 16 additions and 3 deletions

View File

@@ -21,6 +21,11 @@ func NewSession(rw http.ResponseWriter, req *http.Request) {
log.Println(err)
//TODO: Return some error code
} else {
// If request is not a form, return sessionId in the body
if req.Header.Get("Content-Type") != "application/x-www-form-urlencoded" {
rw.Write([]byte(s.Id))
return
}
http.Redirect(rw, req, fmt.Sprintf("/p/%s", s.Id), http.StatusFound)
}
}