hasContentTypeHeader getter added to RequestModel

This commit is contained in:
Ashita Prasad
2024-01-07 15:44:19 +05:30
parent fead5e6a20
commit 805f82a677
5 changed files with 11 additions and 16 deletions

View File

@ -105,10 +105,7 @@ print(data.decode("utf-8"))
var headers = requestModel.enabledHeadersMap;
if (headers.isNotEmpty || hasBody) {
hasHeaders = true;
bool hasContentTypeHeader = headers.keys
.any((k) => k.toLowerCase() == HttpHeaders.contentTypeHeader);
if (hasBody && !hasContentTypeHeader) {
if (hasBody && !requestModel.hasContentTypeHeader) {
headers[HttpHeaders.contentTypeHeader] =
kContentTypeMap[requestModel.requestBodyContentType] ?? "";
}