A small simplification of the standard library net/http in Go.
Use go get
to download the dependency.
go get github.com/Laky-64/http@latest
Then, import
it in your Go files:
import "github.com/Laky-64/http"
The library is designed to be simple and easy to use. Here's an example of a simple request:
res, err := http.ExecuteRequest(
"https://httpbin.org/get",
)
if err != nil {
panic(err)
}
fmt.Println(res)
res, err := http.ExecuteRequest(
"https://ipinfo.io",
http.Proxy("socks5://127.0.0.1:9050"),
)
if err != nil {
panic(err)
}
fmt.Println(res)
res, err := http.ExecuteRequest(
"https://httpbin.org/post",
http.Method("POST"),
http.Body([]byte("Hello, World!")),
)
if err != nil {
panic(err)
}
fmt.Println(res)
res, err := http.ExecuteRequest(
"https://httpbin.org/post",
http.Method("POST"),
http.MultiPartForm(
map[string]string{
"key": "value",
},
map[string]types.FileDescriptor{
"file": {
FileName: "file.txt",
Content: []byte("Hello, World!"),
},
},
),
)
if err != nil {
panic(err)
}
fmt.Println(res)