From e5f653daf9c09a8814d3a8016a207deec525eaab Mon Sep 17 00:00:00 2001 From: Ankit Mahato Date: Mon, 17 Nov 2025 06:26:03 +0530 Subject: [PATCH] detect presence of request body --- packages/better_networking/lib/models/http_request_model.dart | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/better_networking/lib/models/http_request_model.dart b/packages/better_networking/lib/models/http_request_model.dart index 3443e3d6..51caf361 100644 --- a/packages/better_networking/lib/models/http_request_model.dart +++ b/packages/better_networking/lib/models/http_request_model.dart @@ -47,6 +47,10 @@ class HttpRequestModel with _$HttpRequestModel { bool get hasTextContentType => bodyContentType == ContentType.text; int get contentLength => utf8.encode(body ?? "").length; bool get hasBody => hasJsonData || hasTextData || hasFormData; + bool get hasAnyBody => + (hasJsonContentType && contentLength > 0) || + (hasTextContentType && contentLength > 0) || + (hasFormDataContentType && formDataMapList.isNotEmpty); bool get hasJsonData => kMethodsWithBody.contains(method) && hasJsonContentType &&