Fix the incoming name param to /register
This commit is contained in:
parent
5033ec4e63
commit
5691c10b4c
1 changed files with 3 additions and 1 deletions
|
@ -67,7 +67,7 @@ func (s *Server) HandleStatus(w http.ResponseWriter, r *http.Request) {
|
|||
|
||||
// RegisterData describes the data to send when registering
|
||||
type RegisterData struct {
|
||||
Name string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
}
|
||||
|
||||
// RegisterResponse describes the response to a register request
|
||||
|
@ -100,6 +100,8 @@ func (s *Server) HandleRegister(w http.ResponseWriter, r *http.Request) {
|
|||
fmt.Printf("Failed to decode json: %s", err)
|
||||
|
||||
response.Error = err.Error()
|
||||
} else if len(data.Name) == 0 {
|
||||
response.Error = "Cannot register empty name"
|
||||
} else {
|
||||
// log the data sent
|
||||
fmt.Printf("\t%v\n", data)
|
||||
|
|
Loading…
Add table
Reference in a new issue