这是代码,
func sayhelloName(w http.ResponseWriter, r *http.Request) {
fmt.Println("header=", r.Header)
s, \_ := ioutil.ReadAll(r.Body)
fmt.Printf("body=%s\n",s)
}
这是返回值,
header= map[Accept-Encoding:[gzip] Connection:[close] Content-Length:[318512] Content-Type:[multipart/form-data; boundary=---------------------------8d7f730cd9470c6] Remote-Host:[183.250.162.102] User-Agent:[Go-http-client/1.1] X-Forwarded-For:[183.250.162.102, 120.76.211.89] X-Real-Ip:[183.250.162.102]]
body=-----------------------------8d7f730cd9470c6
Content-Disposition: form-data; name="bigFileMd5"
c73c0667b84b04bf3125643fac9331aa
-----------------------------8d7f730cd9470c6
Content-Disposition: form-data; name="cloudtoken"
267d1c6d911d57b64e6ea815818dbaad32cb4434e92234e42677caa5f344a332
-----------------------------8d7f730cd9470c6
Content-Disposition: form-data; name="deleteFile"
111101
-----------------------------8d7f730cd9470c6
Content-Disposition: form-data; name="fileCount"
11
网上的方案都是按照 json 来的,我这个明显不是。如果有现成的方法可以切割开最好,没有就只有手动写了,但我觉得还是不要造轮子比较好,我网上找了一下开源,也没有找到,初入 golang,还请指点一下,谢谢。
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…