Fix handling of missing entries
Change-Id: Id2a7cc75c0ce54b489970b93e1a5815073b77fee
diff --git a/service.go b/service.go
index e1ac40d..3ed40e7 100644
--- a/service.go
+++ b/service.go
@@ -29,6 +29,7 @@
if err != nil {
c.String(http.StatusNotFound, "No entry found")
+ return nil
}
err = item.Value(func(v []byte) error {
diff --git a/service_test.go b/service_test.go
index eee7a79..8e27b56 100644
--- a/service_test.go
+++ b/service_test.go
@@ -32,6 +32,13 @@
router.ServeHTTP(w, req)
assert.Equal(t, http.StatusOK, w.Code)
assert.Equal(t, "sueddeutsche,http://example.org", w.Body.String())
+
+ w = httptest.NewRecorder()
+ req, _ = http.NewRequest(http.MethodGet, "/s11/s12/s14", nil)
+
+ router.ServeHTTP(w, req)
+ assert.Equal(t, http.StatusNotFound, w.Code)
+ assert.Equal(t, "No entry found", w.Body.String())
}
func TestAssetRoute(t *testing.T) {