golang http utils for common use
To get the package, execute:
go get github.com/gofika/httputil
package main
import (
"fmt"
"github.com/gofika/httputil"
)
func main() {
resp, err := httputil.Get("https://httpbin.org/get")
if err != nil {
panic(err)
}
type GetResp struct {
URL string `json:"url"`
}
res, err := httputil.ReadJSON[GetResp](resp)
fmt.Printf("url=%s\n", res.URL)
}