aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--main.go9
1 files changed, 5 insertions, 4 deletions
diff --git a/main.go b/main.go
index 0ad8e89..4d8f111 100644
--- a/main.go
+++ b/main.go
@@ -110,19 +110,20 @@ func parseScrobbles(values url.Values, session *Session) []Scrobble {
func scrobbleHandler(ds DataStore, w http.ResponseWriter, r *http.Request) {
if session, err := ds.GetSession(r.FormValue("s")); err != nil {
+ fmt.Fprintln(w, "BADSESSION")
+ } else {
scrobbles := parseScrobbles(r.Form, session)
+ fmt.Printf("%v\n", scrobbles)
ds.PutScrobbles(scrobbles)
fmt.Fprintln(w, "OK")
- } else {
- fmt.Fprintln(w, "BADSESSION")
}
}
func nowPlayingHandler(ds DataStore, w http.ResponseWriter, r *http.Request) {
if _, err := ds.GetSession(r.FormValue("s")); err != nil {
- fmt.Fprintln(w, "OK")
- } else {
fmt.Fprintln(w, "BADSESSION")
+ } else {
+ fmt.Fprintln(w, "OK")
}
}