diff options
| author | Guillaume Horel <guillaume.horel@gmail.com> | 2016-12-11 21:00:31 -0500 |
|---|---|---|
| committer | Guillaume Horel <guillaume.horel@gmail.com> | 2016-12-11 21:00:31 -0500 |
| commit | 590429cdba3596fc60fa051633428a49002b14cb (patch) | |
| tree | dca24812c502ce82ea291146a02362e8f4f877d0 /main.go | |
| parent | ab778e442ac0384dd8963979c32bfb09c256cfa1 (diff) | |
| download | lastfm-api-590429cdba3596fc60fa051633428a49002b14cb.tar.gz | |
got the tests reversed
Diffstat (limited to 'main.go')
| -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") } } |
