flutter - Content-Length 标头出现多次,最多允许出现一次
问题描述
当我尝试通过以下链接进行连接时:
http://192.168.4.1/wifisave?s=asdasd&p=10001010101010&ip=192.168.1.202&gw=192.168.1.1&sn=255.255.255.0&email=new@test.com&pass=123456789&alarm=1
我收到以下错误
Content-Length 标头出现多次,最多允许出现一次。
即使正常的链接喜欢
http://192.168.1.200/anything
做事,
甚至认为它以前可以工作,我不知道最新版本的库的升级是否会影响到这一点,尝试降级但由于 null-safety 限制和其他 depandancy.. 代码行:
try {
String overAllLink='http://192.168.4.1/wifisave?s=asdasd&p=10001010101010&ip=192.168.1.202&gw=192.168.1.1&sn=255.255.255.0&email=new@test.com&pass=123456789&alarm=1';
response = await http.get(Uri.parse(overAllLink));
} catch (e) {
print(e);
}
编辑:当我尝试从 API 测试器中得到的服务器响应是
> Host: 192.168.4.1
> User-Agent: insomnia/2021.2.2
> Content-Type: multipart/form-data; boundary=X-INSOMNIA-BOUNDARY
> Accept: */*
> Content-Length: 25
| --X-INSOMNIA-BOUNDARY--
* We are completely uploaded and fine
* Mark bundle as not supporting multiuse
< HTTP/1.1 200 OK
< Content-Type: text/html
< Content-Length: 1210
< Content-Length: 1210 //second one.
< Connection: close
所以服务器似乎发送了两次 Content-Length,所以我该如何忽略或解决它,我的服务器是安装了 WiFiManger .16 库的 ESP8266。
解决方案
好的,问题出在我的 ESP8266 服务器上,如问题中所述,它错误地发送了两次 Content-Length,在此处打开一个问题提到确实解决了问题,这要感谢库所有者。
推荐阅读
- solidity - 从 ERC20 智能合约中移除不受信任的代币
- php - Symfony / API / PATCH / multipart/form-data
- python - Python - 批量重命名为时间戳
- ruby-on-rails - 仅允许用户通过单击更改整数输入
- flutter - 如何制作一个具有参数的按钮对象,该参数可以在颤动中动态更改 iconData?
- solr - Hybris 多词产品搜索无法正常工作
- apache-spark - Spark Structured Streaming HDFS 源仅列出带有 _SUCCESS 标志的目录下的文件
- node.js - xmlbuilder2 使用 JS 对象设置文本和属性
- c++ - C++ `enable_shared_from_this` 和 `shared_From_this()` 未编译或运行
- bash - 尝试在 Bash shell 中运行函数会产生意想不到的结果