util.go 255 B

12345678910111213
  1. package manager
  2. import (
  3. "bytes"
  4. "encoding/json"
  5. "net/http"
  6. )
  7. func postJSON(url string, obj interface{}) (*http.Response, error) {
  8. b := new(bytes.Buffer)
  9. json.NewEncoder(b).Encode(obj)
  10. return http.Post(url, "application/json; charset=utf-8", b)
  11. }