mirror of
https://github.com/foss42/apidash.git
synced 2025-11-30 09:48:58 +08:00
detect presence of request body
This commit is contained in:
@@ -47,6 +47,10 @@ class HttpRequestModel with _$HttpRequestModel {
|
|||||||
bool get hasTextContentType => bodyContentType == ContentType.text;
|
bool get hasTextContentType => bodyContentType == ContentType.text;
|
||||||
int get contentLength => utf8.encode(body ?? "").length;
|
int get contentLength => utf8.encode(body ?? "").length;
|
||||||
bool get hasBody => hasJsonData || hasTextData || hasFormData;
|
bool get hasBody => hasJsonData || hasTextData || hasFormData;
|
||||||
|
bool get hasAnyBody =>
|
||||||
|
(hasJsonContentType && contentLength > 0) ||
|
||||||
|
(hasTextContentType && contentLength > 0) ||
|
||||||
|
(hasFormDataContentType && formDataMapList.isNotEmpty);
|
||||||
bool get hasJsonData =>
|
bool get hasJsonData =>
|
||||||
kMethodsWithBody.contains(method) &&
|
kMethodsWithBody.contains(method) &&
|
||||||
hasJsonContentType &&
|
hasJsonContentType &&
|
||||||
|
|||||||
Reference in New Issue
Block a user