Go
Go
Example: Http.QuickGetStr method
Demonstrates theQuickGetStr method.
Chilkat Go Downloads
http := chilkat.NewHttp()
// Keep the response body if there's an error.
http.SetKeepResponseBody(true)
// Send the HTTP GET and return the content in a string.
str := http.QuickGetStr("https://www.chilkatsoft.com/helloWorld.json")
if http.LastMethodSuccess() == false {
if http.LastStatus() == 0 {
// Communications error. We did not get a response.
fmt.Println(http.LastErrorText())
} else {
fmt.Println("Response status code: ", http.LastStatus())
fmt.Println("Response body error text:")
fmt.Println(http.LastResponseBody())
}
http.DisposeHttp()
return
}
fmt.Println(*str)
fmt.Println("Success")
http.DisposeHttp()