From 46ca21b71afbec0affb2b0bd522726d77f13d691 Mon Sep 17 00:00:00 2001 From: zstone12 <522089185@qq.com> Date: Mon, 6 Mar 2023 16:00:54 +0800 Subject: [PATCH] feat: optimize example --- example/main.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/example/main.go b/example/main.go index f8f462e..2809acb 100644 --- a/example/main.go +++ b/example/main.go @@ -55,12 +55,12 @@ import ( ) func main() { - h := server.Default(server.WithHostPorts(":8080")) + h := server.Default(server.WithHostPorts(":8081")) h.Use(gzip.Gzip(gzip.DefaultCompression)) h.GET("/ping", func(ctx context.Context, c *app.RequestContext) { c.String(http.StatusOK, "pong "+fmt.Sprint(time.Now().Unix())) }) - h.Spin() + go h.Spin() cli, err := client.NewClient() if err != nil { @@ -72,10 +72,11 @@ func main() { res := protocol.AcquireResponse() req.SetBodyString("bar") - req.SetRequestURI("http://localhost:8080/ping") + req.SetRequestURI("http://localhost:8081/ping") cli.Do(context.Background(), req, res) if err != nil { panic(err) } + fmt.Println(fmt.Sprintf("%v", res)) }