http2curl
:triangular_ruler: 将Golang的http.Request转换为CURL命令行
要执行相反的操作,请检出 。
例子
import (
"http"
"moul.io/http2curl"
)
data := bytes . NewBufferString ( `{"hello":"world","answer":42}` )
req , _ := http . NewRequest ( "PUT" , "http://www.example.com/abc/def.ghi?jlk=mno&pqr=stu" , data )
req . Header . Set ( "Content-Type" , "application/json" )
command , _ := http2curl . GetCurlCommand ( req )
fmt . Printl
1