Skip to content
Permalink
Browse files

Fixes #53 - Make GET device consistant with API

  • Loading branch information...
lfkeitel committed Mar 29, 2018
1 parent 217bd53 commit cff340e4745bdd5b1ad5759a2fdb34b651aca5db
Showing with 2 additions and 10 deletions.
  1. +2 −10 src/controllers/api/device.go
@@ -5,7 +5,6 @@
package api

import (
"encoding/json"
"errors"
"net"
"net/http"
@@ -575,16 +574,9 @@ func (d *Device) GetDeviceHandler(w http.ResponseWriter, r *http.Request, p http
}

if device.ID == 0 {
w.WriteHeader(http.StatusNotFound)
common.NewAPIResponse("Device not found", nil).WriteResponse(w, http.StatusNotFound)
return
}

deviceJson, err := json.Marshal(device)
if err != nil {
http.Error(w, "Error creating response", http.StatusInternalServerError)
return
}

w.Header().Add("Content-Type", "application/json")
w.Write(deviceJson)
common.NewAPIResponse("Registration successful", device).WriteResponse(w, http.StatusOK)
}

0 comments on commit cff340e

Please sign in to comment.
You can’t perform that action at this time.