From 20ced6222a7c38e2e47194ee1eeba7ffecf10bd1 Mon Sep 17 00:00:00 2001 From: ginuerzh Date: Sat, 27 Jan 2024 21:28:52 +0800 Subject: [PATCH] fix hop http plugin example --- hop/example/http/main.go | 10 +--------- observer/example/http/main.go | 2 +- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/hop/example/http/main.go b/hop/example/http/main.go index fa4fbfa..571aba4 100644 --- a/hop/example/http/main.go +++ b/hop/example/http/main.go @@ -56,10 +56,6 @@ type hopRequest struct { Client string `json:"client"` } -type hopResponse struct { - Node string `json:"node"` -} - func main() { flag.Parse() lis, err := net.Listen("tcp", fmt.Sprintf(":%d", *port)) @@ -80,11 +76,7 @@ func main() { log.Printf("hop: network=%s addr=%s host=%s client=%s", rb.Network, rb.Addr, rb.Host, rb.Client) node := nodes[counter.Add(1)%uint64(len(nodes))] - v, _ := json.Marshal(node) - - resp := hopResponse{Node: string(v)} - - json.NewEncoder(w).Encode(resp) + json.NewEncoder(w).Encode(node) }) if err := http.Serve(lis, nil); err != nil { diff --git a/observer/example/http/main.go b/observer/example/http/main.go index 48bc4b0..3e40d4e 100644 --- a/observer/example/http/main.go +++ b/observer/example/http/main.go @@ -63,7 +63,7 @@ func main() { } resp := observeResponse{ - OK: false, + OK: true, } for _, event := range rb.Events {