diff options
| -rw-r--r-- | main.go | 9 |
1 files changed, 5 insertions, 4 deletions
@@ -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") } } |
