【发布时间】:2018-08-15 19:39:21
【问题描述】:
我正在尝试设置这样的内容类型:
System.FormatException: '值'multipart/form-data;boundary=ce4da8a9-0e0d-4ba6-9f00-e7f3b002a717'的格式无效。'
执行时
HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Post, uri)
{
Content = new StringContent(postData, Encoding.UTF8, content_type) // CONTENT-TYPE header
};
但是按照这个
https://docs.microsoft.com/en-us/skype-sdk/ucwa/batchingrequests https://ucwa.skype.com/documentation/Resources-batch-3 https://ucwa.skype.com/documentation/ProgrammingConcepts-Batch
所有资源都说要使用我拥有的格式。它也没有在 Postman 中抱怨这一点。有没有办法可以在 c# 中的 StringContent 中强制使用这种内容类型?
这里有答案
How do I send arbitrary JSON data, with a custom header, to a REST server?
但我不确定如何实现。
【问题讨论】:
-
我尝试从链接中输入答案,但它显示
__DynamicallyInvokable未定义。