From 590429cdba3596fc60fa051633428a49002b14cb Mon Sep 17 00:00:00 2001 From: Guillaume Horel Date: Sun, 11 Dec 2016 21:00:31 -0500 Subject: got the tests reversed --- main.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'main.go') 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") } } -- cgit v1.2.3-70-g09d2