错误是:
流错误:流ID 1; REFUSED_STREAM
但是curl命令是Ok:
curl -H "Content-type: application/json" -X POST -d '{"skip_mobile":false,"selected_website":[],"basic_info":{"name":"王凯","id_card_num":"410881199210130778","cell_phone_num":"18817953402"}}' https://www.juxinli.com/orgApi/rest/v2/applications/yiqime
我想知道原因
答案 0 :(得分:1)
答案 1 :(得分:0)
Go通过HTTP2连接到nginx时出现问题。
更多详细信息:https://github.com/golang/go/issues/17066
在Go after 1.6版本中,默认情况下启用HTTP2。禁用它应该解决这个问题。
http.DefaultClient.Transport = &http.Transport{
TLSNextProto: make(map[string]func(authority string, c *tls.Conn) http.RoundTripper),
}
resp, err := http.DefaultClient.Do(req)