示例1,提交 Json
请求
g.Client().ContentJson().PostContent(ctx, "http://order.svc/v1/order", g.Map{
"uid" : 1,
"sku_id" : 10000,
"amount" : 19.99,
"create_time" : "2020-03-26 12:00:00",
})
该请求将会将 Content-Type
设置为 application/json
,并且将提交参数自动编码为 Json
:
{"uid":1,"sku_id":10000,"amount":19.99,"create_time":"2020-03-26 12:00:00"}