HomeAssistant: cleanse uri
This commit is contained in:
parent
ddffc8a6d5
commit
d3d902ebd8
2 changed files with 2 additions and 2 deletions
|
|
@ -36,7 +36,7 @@ func NewConnection(log *util.Logger, uri, home string) (*Connection, error) {
|
|||
Helper: request.NewHelper(log),
|
||||
instance: &proxyInstance{
|
||||
home: home,
|
||||
uri: uri,
|
||||
uri: util.DefaultScheme(strings.TrimSuffix(uri, "/"), "http"),
|
||||
},
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ func getInstances(w http.ResponseWriter, req *http.Request) {
|
|||
}
|
||||
|
||||
func getEntities(w http.ResponseWriter, req *http.Request) {
|
||||
uri := req.URL.Query().Get("uri")
|
||||
uri := util.DefaultScheme(strings.TrimSuffix(req.URL.Query().Get("uri"), "/"), "http")
|
||||
if uri == "" {
|
||||
jsonError(w, http.StatusBadRequest, errors.New("missing uri"))
|
||||
return
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue