要上传抖音视频文档,请指定此curl命令。但是,我下面的代码(帖子正文中包含视频路径)看起来不是处理它的正确方法。将此卷曲转换为 HttpClient 逻辑的最佳方法是什么?
curl --location --request PUT 'https://open-upload.tiktokapis.com/video/?upload_id=67890&upload_token=Xza123'
--header '内容范围:字节 0-30567099/30567100'
--header '内容类型:视频/mp4'
--data '@/path/to/file/example.mp4'
HttpClient client = new HttpClient();
request = new HttpRequestMessage(HttpMethod.Put, uploadInfo.data.upload_url);
request.Method = HttpMethod.Put;
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", token);
request.Content =
new StringContent(vidPath);
request.Content.Headers.ContentType = new MediaTypeHeaderValue("video/mp4");
request.Content.Headers.ContentLength = vidSize;
request.Content.Headers.ContentRange = new ContentRangeHeaderValue(0, vidSize);
response = await client.SendAsync(request);
错误
SocketException: An existing connection was forcibly closed by the remote host.
如果你使用 postman ,输入你的curl命令,它会给你c#代码