diff options
| author | Jeff Carr <[email protected]> | 2025-02-15 12:16:27 -0600 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2025-02-15 12:21:34 -0600 |
| commit | 5e837be94b272f6b69b0b68ed070617adcf83ba2 (patch) | |
| tree | 98c485ee2ef2814560da360f0351894cc6f814af /post.go | |
| parent | 46e329f4190bb5b41b1ec5ecf89e319a626f8d63 (diff) | |
move some common things to forgepb
Diffstat (limited to 'post.go')
| -rw-r--r-- | post.go | 48 |
1 files changed, 0 insertions, 48 deletions
diff --git a/post.go b/post.go deleted file mode 100644 index 08c487d..0000000 --- a/post.go +++ /dev/null @@ -1,48 +0,0 @@ -package main - -import ( - "bytes" - "io/ioutil" - "net/http" - "os" - "os/user" - - "go.wit.com/log" -) - -func httpPost(url string, data []byte) ([]byte, error) { - var err error - var req *http.Request - - // data := []byte("some junk") - // url := "https://go.wit.com/register/" - - req, err = http.NewRequest(http.MethodPost, url, bytes.NewBuffer(data)) - - usr, _ := user.Current() - req.Header.Set("author", usr.Username) - hostname, _ := os.Hostname() - req.Header.Set("hostname", hostname) - - client := &http.Client{} - resp, err := client.Do(req) - if err != nil { - log.Error(err) - return []byte("client.Do(req) error"), err - } - defer resp.Body.Close() - - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - log.Error(err) - return body, err - } - - // test := strings.TrimSpace(string(body)) - // log.Info("go.wit.com returned body:", test) - // if test == "OK" { - // return body, nil - // } - - return body, nil -} |
