HttpPayload.json constructor
Encodes body as a JSON string and sets Content-Type to 'application/json'.
Implementation
HttpPayload.json(
Object? body, {
Encoding encoding = utf8,
String? contentType,
}) : contentType =
contentType ?? 'application/json; charset=${encoding.name}',
super(
LazyStream(
() => Stream.value(encoding.encode(json.encode(body))),
),
);