avoid null in json response

This commit is contained in:
Chris Lu 2012-09-04 00:34:28 -07:00
parent a74f6cf593
commit a7d8d46306

View file

@ -43,7 +43,7 @@ func dirLookupHandler(w http.ResponseWriter, r *http.Request) {
volumeId, _ := storage.NewVolumeId(vid) volumeId, _ := storage.NewVolumeId(vid)
machines, e := mapper.Get(volumeId) machines, e := mapper.Get(volumeId)
if e == nil { if e == nil {
var ret []map[string]string ret:= []map[string]string{}
for _, machine := range machines { for _, machine := range machines {
ret = append(ret,map[string]string{"url": machine.Url, "publicUrl": machine.PublicUrl}) ret = append(ret,map[string]string{"url": machine.Url, "publicUrl": machine.PublicUrl})
} }