I'm using dio: ^3.0.4. Any one please help me to find the solution for adding header. here my code:
FormData formData =
new FormData.fromMap({"files": await MultipartFile.fromFile(filePath.path, filename: 'photo')
});
Response response = await dio.post("***********",
data: formData,
onSendProgress: (int sent, int total) {
print("$sent $total");
},
options: Options(
headers: {
"authorization": "*************"
},
followRedirects: false,
validateStatus: (status) {
return status <= 500;
}
),
);
When i print the header.
print(response.headers);
Result:
flutter: content-type: text/html; charset=UTF-8 connection: close cache-control: no-cache, private transfer-encoding: chunked date: Thu, 07 Nov 2019 14:29:02 GMT server: Apache/2.4.18
authorization
in lower case. Dart will typically lower case all header name. Use Postman to confirm that a lower case header name works. – Bertrandapache_request_headers()
on Laravel, need to usereq->request();
. – Doubt