Files
insomnia/packages/insomnia-httpsnippet/test/fixtures/output/go/native/headers.go
T

27 lines
380 B
Go
Executable File

package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "http://mockbin.com/har"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("accept", "application/json")
req.Header.Add("x-foo", "Bar")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}