http.go
func HTTPPostJSON(url string, data interface{}) error {
	b, err := json.MarshalIndent(data, "", "  ")
	if err != nil {
		return err
	}
	response, err := http.Post(url, "application/json", bytes.NewBuffer(b))
	if err == nil && (response.StatusCode < 200 || response.StatusCode > 299) {
		err = errors.New(response.Status)
	}
	return err
}
func HTTPPostJSON(url string, data interface{}) error {
	b, err := json.MarshalIndent(data, "", "  ")
	if err != nil {
		return err
	}
	response, err := http.Post(url, "application/json", bytes.NewBuffer(b))
	if err == nil && (response.StatusCode < 200 || response.StatusCode > 299) {
		err = errors.New(response.Status)
	}
	return err
}
func HTTPPostJSON ( url string , data interface { } ) error { b , err := json . MarshalIndent ( data , " " , " " ) if err != nil { return err } response , err := http . Post ( url , " " , bytes . NewBuffer ( b ) ) if err == nil && ( response . StatusCode < 200 || response . StatusCode > 299 ) { err = errors . New ( response . Status ) } return err }
// HTTPPostJSON marshalles data as JSON
// and sends it as HTTP POST request to url.
// If the response status code is not 200 OK,
// then the status is returned as an error.
HTTPPostJSON marshalles data as JSON and sends it as HTTP POST request to url . If the response status code is not 200 OK then the status is returned as an error .