This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Fetch makes network calls using the method (POST/GET..), the URL // to hit, headers to add (if any), and the body of the request. | |
// Feel free to add more stuff to before/after making the actual n/w call! | |
func Fetch(method string, url string, header map[string]string, body io.Reader) (*http.Response, err) { | |
// Create client with required custom parameters. | |
// Options: Disable keep-alives, 30sec n/w call timeout. | |
client := &http.Client{ | |
Transport: &http.Transport{ | |
DisableKeepAlives: true, | |
}, | |
Timeout: time.Duration(10 * time.Second), |