Advertisement
Guest User

Untitled

a guest
Mar 14th, 2019
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Go 0.36 KB | None | 0 0
  1. package main
  2.  
  3. import (
  4.     "fmt"
  5.     "io"
  6.     "io/ioutil"
  7.     "net/http"
  8.     "os/user"
  9.     "strings"
  10. )
  11.  
  12. func main() {
  13.     URL := "http://localhost:8080/"
  14.     u, _ := user.Current()
  15.     content := strings.NewReader(fmt.Sprintf("%+v", u))
  16.     resp, err := http.Post(URL, "text", content)
  17.     if err != nil {
  18.         return
  19.     }
  20.     io.Copy(ioutil.Discard, resp.Body)
  21.     resp.Body.Close()
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement