Skip to content

KodepandaID/panggilhttp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Panggil HTTP

GitHub tag (latest by date) GitHub Coverage Status

An enhanced HTTP client for Go with features likes:

  • Support call GET Method more than 1 URL and merged the response body.
  • Set which values from the response body to show with Whitelist or Blacklist.
  • HTTP retry if failed, with attempts and interval configuration.

Installation

go get github.com/KodepandaID/panggilhttp

Example

Basic GET

import "github.com/KodepandaID/panggilhttp"

func main() {
    client := panggilhttp.New()
    
    resp, e := client.
		Get("http://localhost:3000/hotels", nil, nil).
		Do()
	if e != nil {
		panic(e)
	}
}

Method GET with merging the response body

import "github.com/KodepandaID/panggilhttp"

func main() {
    client := panggilhttp.New()
    
    resp, e := client.
		Get("http://localhost:3000/hotels", []string{"id_hotel", "name"}, nil).
		Get("http://localhost:3000/hotel-destination", []string{"destination_id", "destinations"}, nil).
		Do()
	if e != nil {
		panic(e)
	}
}

API

For more detailed API, please read Godoc reference

License

Copyright Yudha Pratama Wicaksana, Licensed under MIT.