Skip to content

Commit

Permalink
handleJson not return a list
Browse files Browse the repository at this point in the history
  • Loading branch information
youngsofun committed Dec 10, 2015
1 parent 8fa7934 commit 8981717
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 14 deletions.
14 changes: 1 addition & 13 deletions gobeansdb/web.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ import (
mc "github.intra.douban.com/coresys/gobeansdb/memcache"
"github.intra.douban.com/coresys/gobeansdb/store"
"github.intra.douban.com/coresys/gobeansdb/utils"

yaml "gopkg.in/yaml.v2"
)

// TODO:
Expand Down Expand Up @@ -101,7 +99,7 @@ func handleWebPanic(w http.ResponseWriter) {
}
}

func handleJson(w http.ResponseWriter, v ...interface{}) {
func handleJson(w http.ResponseWriter, v interface{}) {
defer handleWebPanic(w)
b, err := json.Marshal(v)
if err != nil {
Expand All @@ -111,16 +109,6 @@ func handleJson(w http.ResponseWriter, v ...interface{}) {
}
}

func handleYaml(w http.ResponseWriter, v ...interface{}) {
defer handleWebPanic(w)
b, err := yaml.Marshal(v)
if err != nil {
w.Write([]byte(err.Error()))
} else {
w.Write(b)
}
}

func getBucket(r *http.Request) (bucketID int64, err error) {
s := filepath.Base(r.URL.Path)
return strconv.ParseInt(s, 16, 16)
Expand Down
2 changes: 1 addition & 1 deletion tests/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def tearDown(self):
def checkCounterZero(self):
time.sleep(0.5)
content = gethttp(self.db.webaddr, '/buffers')
buffers = json.loads(content)[0]
buffers = json.loads(content)
self.assertEqual(len(buffers), 4)
for _, v in buffers.items():
self.assertEqual(v['Count'], 0, content)
Expand Down

0 comments on commit 8981717

Please sign in to comment.