package mainimport ("bytes""encoding/json""fmt""io/ioutil""net/http")const url = "http://xxxxxxxxxxxxxxxxxx"func postData() bool {data := make(map[string]string)data["username"] = "hequan"data["password"] = "password"b, _ := json.Marshal(data)resp, err := http.Post(url,"application/json",bytes.NewBuffer(b))if err != nil {fmt.Println(err)}defer resp.Body.Close()body, _ := ioutil.ReadAll(resp.Body)fmt.Println(string(body))return true}func main() {postData()}
