gitlab release 发布使用curl调用,我想实现成一个可视化的操作。
那么在c#中怎么使用curl呢?
用HttpClient,或者用Process调用curl
HttpClient client = new HttpClient();
var data = new { name = "release" };
var request = new HttpRequestMessage()
{
Content = new StringContent(JsonConvert.SerializeObject(data), Encoding.UTF8, "application/json"),
RequestUri = new Uri("http://localhost:3000"),
Method = HttpMethod.Post
};
request.Headers.Add("token","token1");
await client.SendAsync(request);
由于对cURL
不熟悉,搜索看了一下就是一个url解析,可以参考阮一峰curl 的用法指南的文章
gitlab release create
gitlab release update