Skip to content

Instantly share code, notes, and snippets.

@yukpiz yukpiz/get_client.go
Last active Sep 11, 2018

Embed
What would you like to do?
package main
import (
"flag"
"fmt"
"io/ioutil"
"log"
"net/http"
)
func main() {
name := flag.String("name", "", "Name")
flag.Parse()
resp, err := http.Get(fmt.Sprintf("http://localhost:8080/Profile/%s", *name))
if err != nil {
log.Fatal(err)
}
defer resp.Body.Close()
bytes, err := ioutil.ReadAll(resp.Body)
if err != nil {
log.Fatal(err)
}
fmt.Println(string(bytes))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.