gopunch
is a simple golang package to make http calls.
go get -u github.com/haquenafeem/gopunch
- Easy To Use
- Use Own Unmarshal Logic
- Create With/Without Timer
- Default JSON Oriented
- Request/Respose Modification
- Examples To Get You Started
- All Tests/Examples Based On
JSON Place Holder
- Tests Passing
package main
import (
"context"
"fmt"
"github.com/haquenafeem/gopunch"
)
type Todo struct {
UserID int `json:"userId"`
ID int `json:"id"`
Title string `json:"title"`
Completed bool `json:"completed"`
}
func main() {
client := gopunch.New("https://jsonplaceholder.typicode.com")
ctx := context.Background()
var todos []Todo
opt := gopunch.WithHeaders(map[string]string{
"Content-Type": "application/json",
})
err := client.GetUnmarshal(ctx, "/todos", &todos, opt)
if err != nil {
panic(err)
}
fmt.Println(todos)
}
Complete Example Here