标签: curl go net-http
例如卷曲代码:
curl "http://example.com" --data-binary $'abc\r\ndef' --compressed
如何将其翻译为Go代码?
我尝试的是:
body := []byte("abc\r\ndef") req, _ := http.NewRequest("POST", "http://example.com", bytes.NewBuffer(body)) resp, _ := http.DefaultClient.Do(req)