Skip to content
This repository was archived by the owner on May 13, 2023. It is now read-only.

Commit 12a85a6

Browse files
authored
Support null body when invoking functions
Currently, when the body is null, the json.encode method will cast it to a string as part of the encoding. This results in the body containing `"null"` which can break some server-side json implementations.
1 parent 086fd9f commit 12a85a6

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/src/functions_client.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ class FunctionsClient {
4141
Map<String, dynamic>? body,
4242
ResponseType responseType = ResponseType.json,
4343
}) async {
44-
final bodyStr = await compute(json.encode, body);
44+
final bodyStr = body == null ? null : await compute(json.encode, body);
4545

4646
final response = await (_httpClient?.post ?? http.post)(
4747
Uri.parse('$_url/$functionName'),

0 commit comments

Comments
 (0)