Skip to content

Instantly share code, notes, and snippets.

@narenaryan
Created March 25, 2024 00:27
Show Gist options
  • Save narenaryan/faaf5531da584e19aef2aa66a7921020 to your computer and use it in GitHub Desktop.
Save narenaryan/faaf5531da584e19aef2aa66a7921020 to your computer and use it in GitHub Desktop.
package main
import (
"fmt"
"net/http"
"time"
)
func main() {
client := &http.Client{Timeout: 5 * time.Second}
resp, err := client.Get("https://httpbin.org/get")
if err != nil {
fmt.Println(err)
return
}
fmt.Println(resp.StatusCode)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment