Skip to content

Commit

Permalink
doc: update readme example
Browse files Browse the repository at this point in the history
Signed-off-by: Marko Kungla <[email protected]>
  • Loading branch information
mkungla committed Mar 15, 2022
1 parent f542a7e commit 3eb9f87
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -157,9 +157,10 @@ func main() {
wg.Add(1)
go func(ctx context.Context, host string) {
defer wg.Done()
// switching host. all options changes are safe to call from goroutines.
koios.Host(host)(api)
res, _ := api.GET(ctx, "/tip", nil, nil)
// switching host by creating light clone of client
// with new options
client, err := api.WithOptions(koios.Host(host))
res, _ := client.GET(ctx, "/tip", nil, nil)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println("Host: ", host)
Expand All @@ -168,7 +169,6 @@ func main() {
}

wg.Wait()
fmt.Println("requests done: ", api.TotalRequests())
}
```

Expand Down

0 comments on commit 3eb9f87

Please sign in to comment.