我有这段代码可以完成基本的发帖请求
public static async Task<string> PostAsync(string uri, string token_type, string access_token, string postData, string accept, string content_type, ErrorList errors)
{
HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Post, uri)
{
Content = new StringContent(postData, Encoding.UTF8, content_type) // CONTENT-TYPE header
};
if (accept != null) request.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(accept)); // ACCEPT header
if (token_type != null && access_token != null) request.Headers.Authorization = new AuthenticationHeaderValue(token_type, access_token);
HttpResponseMessage g = await client.SendAsync(request);
if (g.IsSuccessStatusCode)
{
return await g.Content.ReadAsStringAsync();
}
else
{
errors.AddError(g.ReasonPhrase, await g.Content.ReadAsStringAsync());
return null;
}
}
我正尝试将其转换为分段/批处理,如此处所示
https://docs.microsoft.com/en-us/skype-sdk/ucwa/batchingrequests
这是该站点的示例:
POST https://lyncweb.contoso.com/ucwa/oauth/v1/applications/103/batch HTTP/1.1
Accept: multipart/batching
Content-Type: multipart/batching;boundary=77f2569d-c005-442b-b856-782305305e5f
Authorization: Bearer cwt=AAEB...buHc
X-Ms-Origin: http://localhost
X-Requested-With: XMLHttpRequest
Referer: https://lyncweb.contoso.com/Autodiscover/XFrame/XFra/documentation/Resources-me
Accept-Language: en-us
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0)
Host: lyncweb.contoso.com
Content-Length: 463
Connection: Keep-Alive
Cache-Control: no-cache
--77f2569d-c005-442b-b856-782305305e5f
Content-Type: application/http; msgtype=request
GET /ucwa/oauth/v1/applications/103/people/contacts HTTP/1.1
Host: lyncweb.contoso.com
Accept: application/json
--77f2569d-c005-442b-b856-782305305e5f
Content-Type: application/http; msgtype=request
GET /ucwa/oauth/v1/applications/103/me HTTP/1.1
Host: lyncweb.contoso.com
Accept: application/json
--77f2569d-c005-442b-b856-782305305e5f--
如何使用我的Post示例中的技术发出等效的c#请求?