shenghy / flutter_shop

一个Flutter的电商实战项目,包括首页、列表页、详细页、购物车页和会员中心,配有全套文字和视频教程。

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

按照教程, 使用flutter Dio伪造请求头, 请求失败, 提示 Refused to set unsafe header "host"

drooop opened this issue · comments

网上查了资料,发现有人说现在请求头不能写某几个key?
然后看了Dio库里的Headers类,发现里面有默认支持的几个key

httpHeaders = {
Headers.acceptHeader: "application/json, text/plain, /",
Headers.contentEncodingHeader: "gzip, deflate, br, drop",
Headers.contentLengthHeader: '',
Headers.contentTypeHeader: 'application/json'
}

是不是除了这几个,其他的都不支持呢(比如'origin')

跪求解惑,拜托大家了