mirror of
https://github.com/quii/learn-go-with-tests.git
synced 2026-02-01 17:47:03 +00:00
Merge pull request #58 from pdbrito/http-fixes
Fix check for zero value
This commit is contained in:
commit
f030fdb2b9
@ -675,7 +675,7 @@ func (p *PlayerServer) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
score := p.store.GetPlayerScore(player)
|
||||
|
||||
if score == "" {
|
||||
if score == 0 {
|
||||
w.WriteHeader(http.StatusNotFound)
|
||||
}
|
||||
|
||||
@ -704,7 +704,7 @@ func (p *PlayerServer) showScore(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
score := p.store.GetPlayerScore(player)
|
||||
|
||||
if score == "" {
|
||||
if score == 0 {
|
||||
w.WriteHeader(http.StatusNotFound)
|
||||
}
|
||||
|
||||
@ -897,7 +897,7 @@ func (p *PlayerServer) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
func (p *PlayerServer) showScore(w http.ResponseWriter, player string) {
|
||||
score := p.store.GetPlayerScore(player)
|
||||
|
||||
if score == "" {
|
||||
if score == 0 {
|
||||
w.WriteHeader(http.StatusNotFound)
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user