Skip to content

Commit

Permalink
feat: improve sample code to learn
Browse files Browse the repository at this point in the history
  • Loading branch information
tonnytg committed Jul 20, 2024
1 parent d00cba9 commit 0f82fad
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions examples/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,16 @@ func main() {
request.SetHeaders(headers.Headers) // Set map directly
request.SetTimeout(10)

body, err := request.Execute()
response, err := request.Execute()
if err != nil {
fmt.Println(err)
}
bodyString := string(body)
bodyString := string(response)
if bodyString == "" {
fmt.Println("body is empty")
fmt.Println("response status code:", request.StatusCode)
fmt.Println("response body:", bodyString)
}

fmt.Println(bodyString)
fmt.Println("response status code:", request.StatusCode)
fmt.Println("response body:", bodyString)
}

0 comments on commit 0f82fad

Please sign in to comment.