Skip to content

Commit

Permalink
feat: optimize example
Browse files Browse the repository at this point in the history
  • Loading branch information
zstone12 committed Mar 6, 2023
1 parent 947dfe7 commit 46ca21b
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions example/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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))
}

0 comments on commit 46ca21b

Please sign in to comment.