summaryrefslogtreecommitdiffstats
path: root/main.go
diff options
context:
space:
mode:
authorGuillaume Horel <guillaume.horel@gmail.com>2016-12-11 21:00:31 -0500
committerGuillaume Horel <guillaume.horel@gmail.com>2016-12-11 21:00:31 -0500
commit590429cdba3596fc60fa051633428a49002b14cb (patch)
treedca24812c502ce82ea291146a02362e8f4f877d0 /main.go
parentab778e442ac0384dd8963979c32bfb09c256cfa1 (diff)
downloadlastfm-api-590429cdba3596fc60fa051633428a49002b14cb.tar.gz
got the tests reversed
Diffstat (limited to 'main.go')
-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")
}
}