使用主体作为 multipart/form-data 调用 Api
我必须调用一个 Api,将主体作为具有 4 个参数的多部分/表单数据。 我已经这样做了:`
MultipartFormDataContent body = new MultipartFormDataContent();
body.Add(new StringContent("item_id"), value);
body.Add(new StringContent("ateco_code"), value);
body.Add(new StringContent("province"), value);
body.Add(new StringContent("csv_data"), value);
然后将主体转换为流,因为Api需要一个流(System.IO.Stream主体) var bodystream = body.ReadAsStreamAsync().Result;
这是正确的吗?因为我总是收到错误的请求
i have to call an Api that get a body as multipart/form-data with 4 parameters.
I have done so:`
MultipartFormDataContent body = new MultipartFormDataContent();
body.Add(new StringContent("item_id"), value);
body.Add(new StringContent("ateco_code"), value);
body.Add(new StringContent("province"), value);
body.Add(new StringContent("csv_data"), value);
And then transform the body into stream because Api want a stream (System.IO.Stream body)
var bodystream = body.ReadAsStreamAsync().Result;
It's correct? Because i get always BAD REQUEST
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论