Format and validate connection url on /api/connect endpoint

This commit is contained in:
Dan Sosedoff 2014-12-31 18:23:51 -06:00
parent 5f7b18fe0e
commit 00fa57d9c4

8
api.go
View File

@ -79,6 +79,14 @@ func API_Connect(c *gin.Context) {
return return
} }
opts := Options{Url: url}
url, err := formatConnectionUrl(opts)
if err != nil {
c.JSON(400, Error{err.Error()})
return
}
client, err := NewClientFromUrl(url) client, err := NewClientFromUrl(url)
if err != nil { if err != nil {
c.JSON(400, Error{err.Error()}) c.JSON(400, Error{err.Error()})