diff options
author | Collin Guarino <collin.guarino@gmail.com> | 2016-02-04 14:38:39 -0500 |
---|---|---|
committer | Collin Guarino <collin.guarino@gmail.com> | 2016-02-04 14:38:39 -0500 |
commit | a0a8f16f81b36bd700a3d08780ac6e67a9dfc8a0 (patch) | |
tree | d989c38f6f8baf004d763413ae0a46e66ed53ed2 /bridge.go | |
parent | f57f0c6b98ce758756e6c5f2c4aaf8946f5e5cb5 (diff) |
Added index to Light struct to easily reference it from []light.
Diffstat (limited to 'bridge.go')
-rw-r--r-- | bridge.go | 8 |
1 files changed, 7 insertions, 1 deletions
@@ -75,7 +75,13 @@ func (self *Bridge) Post(path string, params interface{}) ([]byte, io.Reader, er func (self *Bridge) Put(path string, params interface{}) ([]byte, io.Reader, error) { uri := fmt.Sprintf("http://" + self.IPAddress + path) client := &http.Client{} - request, err := http.NewRequest("PUT", uri, strings.NewReader(params)) + + data, err := json.Marshal(params) + if err != nil { + return []byte{}, nil, err + } + + request, err := http.NewRequest("PUT", uri, bytes.NewReader(data)) resp, err := client.Do(request) if err != nil { return []byte{}, nil, err |