https://github.com/chyroc/gorequests
https://github.com/chyroc/gorequests
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/chyroc/gorequests
- Owner: chyroc
- License: apache-2.0
- Created: 2020-03-24T05:26:33.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2023-03-07T05:30:58.000Z (almost 3 years ago)
- Last Synced: 2025-08-15T13:55:09.594Z (5 months ago)
- Language: Go
- Size: 46.9 KB
- Stars: 4
- Watchers: 2
- Forks: 6
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# gorequests
[](https://codecov.io/gh/chyroc/gorequests)
[](https://goreportcard.com/report/github.com/chyroc/gorequests)
[](https://github.com/chyroc/gorequests/actions)
[](https://opensource.org/licenses/Apache-2.0)
[](https://pkg.go.dev/github.com/chyroc/gorequests)
[](https://badge.fury.io/go/github.com%2Fchyroc%2Fgorequests)
> Simple and easy-to-use go http client, supports cookies, streaming calls, custom logs and other functions
## Install
```shell
go get github.com/chyroc/gorequests
```
## Usage
### Simple Send Request
```go
func main() {
text, err := gorequests.New(http.MethodGet, "https://jsonplaceholder.typicode.com/todos/1").Text()
if err != nil {
panic(err)
}
fmt.Println("text", text)
}
```
### Send Request With Cookie
```go
func main() {
session := gorequests.NewSession("/tmp/gorequests-session.txt")
text, err := session.New(http.MethodGet, "https://jsonplaceholder.typicode.com/todos/1").Text()
if err != nil {
panic(err)
}
fmt.Println("text", text)
}
```
### Request Factory
```go
func main() {
fac := gorequests.NewFactory(
gorequests.WithLogger(gorequests.NewDiscardLogger()),
)
text, err := fac.New(http.MethodGet, "https://jsonplaceholder.typicode.com/todos/1").Text()
if err != nil {
panic(err)
}
fmt.Println("text", text)
}
```