Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nahid/gohttp
HTTP client for Go
https://github.com/nahid/gohttp
go golang http http-client request
Last synced: 29 days ago
JSON representation
HTTP client for Go
- Host: GitHub
- URL: https://github.com/nahid/gohttp
- Owner: nahid
- License: mit
- Created: 2017-11-08T15:28:32.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2023-05-31T07:41:05.000Z (over 1 year ago)
- Last Synced: 2024-06-18T15:40:53.559Z (5 months ago)
- Topics: go, golang, http, http-client, request
- Language: Go
- Size: 39.1 KB
- Stars: 63
- Watchers: 5
- Forks: 16
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# gohttp
[![Build Status](https://travis-ci.org/nahid/gohttp.svg?branch=master)](https://travis-ci.org/nahid/gohttp)
[![Go Report Card](https://goreportcard.com/badge/github.com/nahid/gohttp)](https://goreportcard.com/report/github.com/nahid/gohttp)
[![Coverage Status](https://coveralls.io/repos/github/nahid/gohttp/badge.svg?branch=master)](https://coveralls.io/github/nahid/gohttp?branch=master)HTTP client for Go, its also support asynchronous request
## Installation
```
go get github.com/nahid/gohttp
```### Example
#### `POST https://httpbin.org/post`
```go
package mainimport (
"github.com/nahid/gohttp"
"fmt"
)func main() {
req := gohttp.NewRequest()resp, err := req.
FormData(map[string]string{"name": "Nahid"}).
Post("https://httpbin.org/post")if err != nil {
panic(err)
}if resp.GetStatusCode() == 200 {
var resps map[string]interface{}_ = resp.GetBodyWithUnmarshal(&resps)
fmt.Println(resps["form"])
}
}
```#### Async Example
```go
package mainimport (
"github.com/nahid/gohttp"
"fmt"
)func main() {
req := gohttp.NewRequest()
ch := make(chan *gohttp.AsyncResponse)var users [3]string
users[0] = "nahid"
users[1] = "shipu"
users[2] = "sujan"for i:=0; i