post访问接口传多个参数
I ran into a little issue as I tried to POST to a Go backend using Axios but I could not get the parameters I was sending.
尝试使用Axios POST到Go后端时遇到一个小问题,但我无法获取正在发送的参数。
I was doing this:
我正在这样做:
func handleReq(w http.ResponseWriter, req *http.Request) {
err := req.ParseForm()
if err != nil {
panic(err)
}
v := req.Form
owner := req.Form.Get("owner")
name := req.Form.Get("name")
//...
}
but the two parameters I was looking for were not available. Why?
但是我正在寻找的两个参数不可用。 为什么?
Turns out that I was assuming Axios sent the parameters using Content-Type:application/x-www-form-urlencoded
but by default it’s u