The Go net/http package exposes a flexible http.Client struct for working with HTTP APIs. This struct has separate transport functionality and is relatively simple to short-circuit requests, modify headers for each client operation, and handle any REST operations. Creating clients is a very common operation, and this recipe will start with the basics of working and creating an http.Client object.
Initializing, storing, and passing http.Client structs
Getting ready
Configure your environment according to these steps:
- Download and install Go on your operating system from https://golang.org/doc/install and configure your GOPATH environment variable.
- Open a terminal/console application.
- Navigate to GOPATH/src and create a project...