我在 dart 中使用MultipartRequest以便将文件上传到 API。但是我需要在我的请求中添加一个授权标头。我面临的问题是 header 属性是最终的,我不能覆盖它。我该如何解决?谢谢!
Ric*_*eap 27
headers是 a Map,所以添加键/值。
http.MultipartRequest request =
new http.MultipartRequest('POST', Uri.parse(url));
request.headers['authorization'] = 'the auth header value';
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3460 次 |
| 最近记录: |