LoginSignup
0
1

More than 5 years have passed since last update.

InvalidOperationException: Cannot override system-specified headersが出た時の対処法

Posted at

UnityでInvalidOperationException: Cannot override system-specified headersというエラーが出てしまったときの対処法です。

原因

Unity5.6からUnity2017にアップデートされた際にWWWの仕様が変わり、自動的に設定されるheaderが増えたのが原因です。
自動的に設定されるheaderを追加してWWWインスタンスを生成しようとするとエラーになります。

Dictionary<string, string> headers = new Dictionary<string, string>();
headers["Content-Length"] = data.Length.ToString();
WWW www = new WWW(url, data, headers); //エラー

対処法

該当するheaderを削除します。
エラー情報に表示されないため、どれが該当するheaderなのかは一つずつ調べていくしかありません。
自分が調べた限り、Content-Lengthは該当するheaderです。

参考

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1