上传者: 42112894
|
上传时间: 2022-03-29 22:15:33
|
文件大小: 26KB
|
文件类型: -
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