https://github.com/nahid/gohttp
HTTP client for Go
https://github.com/nahid/gohttp
go golang http http-client request
Last synced: 10 months 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 8 years ago)
- Default Branch: master
- Last Pushed: 2023-05-31T07:41:05.000Z (over 2 years ago)
- Last Synced: 2025-04-13T16:07:32.952Z (10 months ago)
- Topics: go, golang, http, http-client, request
- Language: Go
- Size: 39.1 KB
- Stars: 64
- Watchers: 4
- Forks: 18
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# gohttp
[](https://travis-ci.org/nahid/gohttp)
[](https://goreportcard.com/report/github.com/nahid/gohttp)
[](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 main
import (
"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 main
import (
"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