Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix content-type error #240

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

fix content-type error #240

wants to merge 1 commit into from

Conversation

zhaotianff
Copy link

HttpManager类的Post和Get函数会引发异常。

异常信息:

{
  code:0
  
  ref-code:0
  ref-text:
  [2022-10-18 11:23:33.4841] [QiniuCSharpSDK/8.2.0 (UNKNOWN; Win32NT; 6.2.9200.0)] [HTTP-POST] Error:  必须使用适当的属性或方法修改“content-type”标头。
  参数名: name 


}

经过排查,发现是

foreach (string fieldName in headers.Keys)
{
      wReq.Headers.Add(fieldName, headers[fieldName]);
}     

循环头部信息时,Content-Type也在其中
Content-Type不能在头部进行设置,只能通过Content-Type属性设置

系统环境:

  • Windows 10 专业版 1903(18362.295)
  • .Net Framework 4.7.2
  • Visual Studio 2019 Community 16.11.18

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants