8000 GitHub - Laky-64/http: A smol, simplification of net/http library 🦊
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Laky-64/http

Repository files navigation

http

A small simplification of the standard library net/http in Go.

Usage

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:

Simple Request

res, err := http.ExecuteRequest(
    "https://httpbin.org/get",
)
if err != nil {
    panic(err)
}
fmt.Println(res)

Example of a simple request

Proxy Request

res, err := http.ExecuteRequest(
    "https://ipinfo.io",
    http.Proxy("socks5://127.0.0.1:9050"),
)
if err != nil {
    panic(err)
}
fmt.Println(res)

Example of a proxy request

POST Request

res, err := http.ExecuteRequest(
    "https://httpbin.org/post",
    http.Method("POST"),
    http.Body([]byte("Hello, World!")),
)
if err != nil {
    panic(err)
}
fmt.Println(res)

Example of a post request

MultiPart Request

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)

Example of a multipart request

About

A smol, simplification of net/http library 🦊

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

0