diff options
Diffstat (limited to 'api/rest.go')
-rw-r--r-- | api/rest.go | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/api/rest.go b/api/rest.go index 909fd541..fc421805 100644 --- a/api/rest.go +++ b/api/rest.go @@ -80,7 +80,7 @@ type RestResponse interface { type RestResponseDefault struct { ResponseErr error - Data []byte + Data interface{} } func (r *RestResponseDefault) Err() error { @@ -96,14 +96,6 @@ type RestResponseNeighbor struct { UpdateCount int } -// Response struct for Rib -type RestResponseRib struct { - RestResponseDefault - RemoteAddr string - RemoteAs uint32 - RibInfo []string -} - type RestServer struct { port int bgpServerCh chan *RestRequest @@ -226,7 +218,8 @@ func (rs *RestServer) NeighborLocalRib(w http.ResponseWriter, r *http.Request) { res := resInf.(*RestResponseDefault) w.Header().Set("Content-Type", "application/json; charset=utf-8") - w.Write(res.Data) + j, _ := json.Marshal(res.Data) + w.Write(j) } func NotFoundHandler(w http.ResponseWriter, r *http.Request) { |