[Go]GO语言实现发送post请求
发布时间:2021-05-21 06:42:42 所属栏目:大数据 来源: https://www.jb51.cc
导读:// Post(" http://xxxx ","application/json;charset=utf-8",[]byte("{'aaa':'bbb'}")) func Post(url string ,contentType byte ) ( string ,error) { res,err : = http.Post(url,contentType,strings.NewReader( (body))) if err != nil { return "" = IoU
//Post("http://xxxx","application/json;charset=utf-8",[]byte("{'aaa':'bbb'}")) func Post(url string,contentType byte) (string,error) { res,err := http.Post(url,contentType,strings.NewReader((body))) if err != nil { return "" IoUtil.ReadAll(res.Body) return (content),nil } 发送一个JSON类型的请求 Post("http://xxxx",[]byte("{'aaa':'bbb'}")) ? (编辑:北几岛) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |