This recipe will show you how to construct a HTTP request with specific parameters.
Creating an HTTP request
How to do it...
- Open the console and create the folder chapter07/recipe06.
- Navigate to the directory.
- Create the request.go file with the following content:
package main
import (
"fmt"
"io/ioutil"
"net/http"
"net/url"
"strings"
)
type StringServer string
func (s StringServer) ServeHTTP(rw http.ResponseWriter,
req *http.Request) {
req.ParseForm()
fmt.Printf("Received form data: %v\n", req.Form)
fmt.Printf("...