func main() { // // Struct to hold error response // e := struct { Message string }{} // Start Session s := napping.Session{} url := "http://httpbin.org/user-agent" fmt.Println("URL:>", url) res := ResponseUserAgent{} resp, err := s.Get(url, nil, &res, nil) if err != nil { log.Fatal(err) } // // Process response // println("") fmt.Println("response Status:", resp.Status()) if resp.Status() == 200 { // fmt.Printf("Result: %s\n\n", resp.response) // resp.Unmarshal(&e) fmt.Println("res:", res.Useragent) } else { fmt.Println("Bad response status from Github server") fmt.Printf("\t Status: %v\n", resp.Status()) fmt.Printf("\t Message: %v\n", e.Message) } fmt.Println("--------------------------------------------------------------------------------") println("") url = "http://httpbin.org/get" fmt.Println("URL:>", url) fooParams := napping.Params{"foo": "bar"} p := fooParams res = ResponseUserAgent{} resp, err = s.Get(url, &p, &res, nil) if err != nil { log.Fatal(err) } // // Process response // println("") fmt.Println("response Status:", resp.Status()) fmt.Println("--------------------------------------------------------------------------------") fmt.Println("Header") fmt.Println(resp.HttpResponse().Header) fmt.Println("--------------------------------------------------------------------------------") fmt.Println("RawText") fmt.Println(resp.RawText()) println("") }