Files
mtusi2026lab2/cmd/healthcheck/main.go
T

25 lines
314 B
Go

package main
import (
"net/http"
"os"
"time"
)
func main() {
client := http.Client{
Timeout: 2 * time.Second,
}
response, err := client.Get("http://127.0.0.1:8080/health/ready")
if err != nil {
os.Exit(1)
}
defer response.Body.Close()
if response.StatusCode != http.StatusOK {
os.Exit(1)
}
}