Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/edoger/zkits-requester
Zero dependency HTTP client.
https://github.com/edoger/zkits-requester
go golang http-client requester uploader zkits
Last synced: 11 days ago
JSON representation
Zero dependency HTTP client.
- Host: GitHub
- URL: https://github.com/edoger/zkits-requester
- Owner: edoger
- License: apache-2.0
- Created: 2020-05-24T07:53:48.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2021-04-11T04:30:41.000Z (over 3 years ago)
- Last Synced: 2024-06-19T15:16:08.134Z (7 months ago)
- Topics: go, golang, http-client, requester, uploader, zkits
- Language: Go
- Homepage:
- Size: 153 KB
- Stars: 14
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ZKits Requester Library #
[![ZKits](https://img.shields.io/badge/ZKits-Library-f3c)](https://github.com/edoger/zkits-requester)
[![Build Status](https://travis-ci.org/edoger/zkits-requester.svg?branch=master)](https://travis-ci.org/edoger/zkits-requester)
[![Build status](https://ci.appveyor.com/api/projects/status/0hreadwn4rb9mkw2/branch/master?svg=true)](https://ci.appveyor.com/project/edoger56924/zkits-requester/branch/master)
[![Coverage Status](https://coveralls.io/repos/github/edoger/zkits-requester/badge.svg?branch=master)](https://coveralls.io/github/edoger/zkits-requester?branch=master)
[![Codacy Badge](https://app.codacy.com/project/badge/Grade/8da10a218dbe4700bcbb409718538fab)](https://www.codacy.com/gh/edoger/zkits-requester/dashboard?utm_source=github.com&utm_medium=referral&utm_content=edoger/zkits-requester&utm_campaign=Badge_Grade)
[![Go Report Card](https://goreportcard.com/badge/github.com/edoger/zkits-requester)](https://goreportcard.com/report/github.com/edoger/zkits-requester)
[![Golang Version](https://img.shields.io/badge/golang-1.14+-orange)](https://github.com/edoger/zkits-requester)## About ##
This package is a library of ZKits project.
This library provides an efficient and easy-to-use HTTP client.## Install ##
```sh
go get -u -v github.com/edoger/zkits-requester
```## Usage ##
```go
package mainimport (
"fmt""github.com/edoger/zkits-requester"
)func main() {
client := requester.Default()// client.Get("https://test.com", nil)
res, err := client.New("https://test.com").Get()
if err != nil {
panic(err)
}
fmt.Println(res.String())data := map[string]interface{}{"key": "value"}
// client.PostJSON("https://test.com", data)
res, err = client.New("https://test.com").WithJSONBody(data).Post()
if err != nil {
panic(err)
}obj := make(map[string]interface{})
// Bind response json to object.
if err = res.JSON(&obj); err != nil {
panic(err)
}// client.UploadFile("https://test.com", "upload", "path/to/file")
res, err = client.New("https://test.com").WithFormDataFile("upload", "path/to/file").Upload()
if err != nil {
panic(err)
}
fmt.Println(res.String())
}
```## License ##
[Apache-2.0](http://www.apache.org/licenses/LICENSE-2.0)