mirror of
https://github.com/gospider007/requests.git
synced 2025-12-24 13:57:52 +08:00
4.6 KiB
4.6 KiB
Requests - A next-generation HTTP client for Golang.
Requests is a fully featured HTTP client library for Golang. Network requests can be completed with just a few lines of code
Features
- GET, POST, PUT, DELETE, HEAD, PATCH, OPTIONS, etc.
- Simple for settings and request
- Request Body can be
string,[]byte,struct,map,sliceandio.Readertoo- Auto detects
Content-Type - Buffer less processing for
io.Reader - Flow request
- Auto detects
- Response object gives you more possibility
- Automatic marshal and unmarshal for content
- Easy to upload one or more file(s) via
multipart/form-data- Auto detects file content type
- Request URL Path Params (aka URI Params)
- Backoff Retry Mechanism with retry condition function
- Optionally allows GET request with payload
- Request design
- Have client level settings & options and also override at Request level if you want to
- Request and Response middleware
- goroutine concurrent safe
- Gzip - Go does it automatically also requests has fallback handling too
- Works fine with
HTTP/2andHTTP/1.1
- Session
- IPv4, IPv6 Address Control Parsing
- DNS Settings
- Fingerprint
- JA3
- HTTP2
- JA4
- OrderHeaders
- Request header capitalization
- Proxy
- HTTP
- HTTPS
- SOCKS5
- Protocol
- HTTP
- HTTPS
- WebSocket
- SSE
- Well tested client library
Supported Go Versions
Recommended to use go1.21.3 and above.
Initially Requests started supporting go modules
Installation
go get github.com/gospider007/requests
Usage
import "github.com/gospider007/requests"
Quickly send requests
package main
import (
"log"
"time"
"github.com/gospider007/requests"
)
func main() {
resp, err := requests.Get(nil, "http://httpbin.org/anything")
if err != nil {
log.Panic(err)
}
log.Print(resp.Text()) // Get content and parse as string
log.Print(resp.Content()) // Get content as bytes
log.Print(resp.Json()) // Get content and parse as gjson JSON
log.Print(resp.Html()) // Get content and parse as goquery DOM
log.Print(resp.Cookies()) // Get cookies
}
Contributing
If you have a bug report or feature request, you can open an issue
Contact
If you have questions, feel free to reach out to us in the following ways:
Sponsors
If you like and it really helps you, feel free to reward me with a cup of coffee, and don't forget to mention your github id.
|
Alipay |


