package notifications import ( "bytes" "context" "net/http" ) // DoPost accepts a stringified body makes a post request func DoPost(url string, body string, headers map[string]string) (resp *http.Response, err error) { req, err := http.NewRequestWithContext(context.Background(), http.MethodPost, url, bytes.NewBuffer([]byte(body))) if err != nil { return } for k, v := range headers { req.Header.Add(k, v) } hc := http.Client{} return hc.Do(req) }