Http reequest
package main
-import "fmt"
+import (
+ "bufio"
+ "fmt"
+ "net/http"
+)
func main() {
- fmt.Println("Hello world!")
+ resp, err := http.Get("http://localhost:19071/ApplicationStatus")
+ if err != nil {
+ panic(err)
+ }
+ defer resp.Body.Close()
+
+ fmt.Println("Response status: ", resp.Status)
+ scanner := bufio.NewScanner(resp.Body)
+ for i := 0; scanner.Scan() && i < 5; i++ {
+ fmt.Println(scanner.Text())
+ }
+
+ if err := scanner.Err(); err != nil {
+ panic(err)
+ }
}
