Skip to content

Commit

Permalink
use proper status codes
Browse files Browse the repository at this point in the history
  • Loading branch information
Woellchen committed Jul 9, 2019
1 parent a475a51 commit 553486e
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions server.go
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,14 @@ func (s *server) getPausedStatus(w http.ResponseWriter) {
// setPausedStatus sets the desired state
func (s *server) setPausedStatus(w http.ResponseWriter, paused bool) {
s.paused = paused
w.WriteHeader(http.StatusOK)

var code int
if paused {
code = http.StatusCreated
} else {
code = http.StatusNoContent
}
w.WriteHeader(code)
}

// parseAddr parses schema and host/path from a URI for use with net.Dial/Listen
Expand Down Expand Up @@ -426,5 +433,5 @@ func (s *server) handleBlockUntilIdle(w http.ResponseWriter, req *http.Request)
}

s.clientWg.Wait()
w.WriteHeader(http.StatusOK)
w.WriteHeader(http.StatusNoContent)
}

0 comments on commit 553486e

Please sign in to comment.