mozillazg / Request
Licence: mit
A developer-friendly HTTP request library for Gopher.
Stars: ✭ 394
Projects that are alternatives of or similar to Request
webargs-starlette
Declarative request parsing and validation for Starlette with webargs
Stars: ✭ 36 (-90.86%)
Mutual labels: request
Sync Request
Make synchronous web requests with cross platform support.
Stars: ✭ 289 (-26.65%)
Mutual labels: request
psr7-http-message
💫 PSR #7 [HTTP Message Interface] to Nette Framework (@nette)
Stars: ✭ 17 (-95.69%)
Mutual labels: request
Cors
🔮Supported(Laravel/Lumen/PSR-15/Swoft/Slim/ThinkPHP) - PHP CORS (Cross-origin resource sharing) middleware.
Stars: ✭ 266 (-32.49%)
Mutual labels: request
Daisynet
1. - Alamofire与Cache封装 , 更容易存储请求数据. 2. - 封装Alamofire下载,使用更方便
Stars: ✭ 331 (-15.99%)
Mutual labels: request
request-extra
⚡️ Extremely stable HTTP request module built on top of libcurl with retries, timeouts and callback API
Stars: ✭ 14 (-96.45%)
Mutual labels: request
axios-for-observable
A RxJS wrapper for axios, same api as axios absolutely
Stars: ✭ 13 (-96.7%)
Mutual labels: request
Gaxios
An HTTP request client that provides an axios like interface over top of node-fetch. Super lightweight. Supports proxies and all sorts of other stuff.
Stars: ✭ 301 (-23.6%)
Mutual labels: request
Allorigins
👽 Pull contents from any page as JSON via API
Stars: ✭ 343 (-12.94%)
Mutual labels: request
mock-req-res
Extensible mock req / res objects for use in unit tests of Express controller and middleware functions.
Stars: ✭ 39 (-90.1%)
Mutual labels: request
Netfox
A lightweight, one line setup, iOS / OSX network debugging library! 🦊
Stars: ✭ 3,188 (+709.14%)
Mutual labels: request
Laravel Csp
Set content security policy headers in a Laravel app
Stars: ✭ 388 (-1.52%)
Mutual labels: request
Requestnetwork
A JavaScript library for interacting with the Request Network protocol
Stars: ✭ 311 (-21.07%)
Mutual labels: request
request
A developer-friendly HTTP request library for Gopher. Inspired by Python-Requests.
Installation
go get -u github.com/mozillazg/request
Documentation
API documentation can be found here: https://godoc.org/github.com/mozillazg/request
Usage
import (
"github.com/mozillazg/request"
)
GET:
c := new(http.Client)
req := request.NewRequest(c)
resp, err := req.Get("http://httpbin.org/get")
j, err := resp.Json()
defer resp.Body.Close() // Don't forget close the response body
POST:
req := request.NewRequest(c)
req.Data = map[string]string{
"key": "value",
"a": "123",
}
resp, err := req.Post("http://httpbin.org/post")
Cookies:
req := request.NewRequest(c)
req.Cookies = map[string]string{
"key": "value",
"a": "123",
}
resp, err := req.Get("http://httpbin.org/cookies")
Headers:
req := request.NewRequest(c)
req.Headers = map[string]string{
"Accept-Encoding": "gzip,deflate,sdch",
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8",
}
resp, err := req.Get("http://httpbin.org/get")
Files:
req := request.NewRequest(c)
f, err := os.Open("test.txt")
req.Files = []request.FileField{
request.FileField{"file", "test.txt", f},
}
resp, err := req.Post("http://httpbin.org/post")
Json:
req := request.NewRequest(c)
req.Json = map[string]string{
"a": "A",
"b": "B",
}
resp, err := req.Post("http://httpbin.org/post")
req.Json = []int{1, 2, 3}
resp, err = req.Post("http://httpbin.org/post")
Proxy:
req := request.NewRequest(c)
req.Proxy = "http://127.0.0.1:8080"
// req.Proxy = "https://127.0.0.1:8080"
// req.Proxy = "socks5://127.0.0.1:57341"
resp, err := req.Get("http://httpbin.org/get")
or https://github.com/mozillazg/request/tree/develop/_example/proxy
HTTP Basic Authentication:
req := request.NewRequest(c)
req.BasicAuth = request.BasicAuth{"user", "passwd"}
resp, err := req.Get("http://httpbin.org/basic-auth/user/passwd")
License
Under the MIT License.
Note that the project description data, including the texts, logos, images, and/or trademarks,
for each open source project belongs to its rightful owner.
If you wish to add or remove any projects, please contact us at [email protected].