HttpPayload.formFields constructor

HttpPayload.formFields(
  1. Map<String, String> body, {
  2. Encoding encoding = utf8,
  3. String? contentType,
})

A form-encoded body of key=value pairs.

Implementation

HttpPayload.formFields(
  Map<String, String> body, {
  Encoding encoding = utf8,
  String? contentType,
})  : contentType = contentType ??
          'application/x-www-form-urlencoded; charset=${encoding.name}',
      super(
        LazyStream(
          () => Stream.value(
            encoding.encode(_encodeFormValues(body, encoding: encoding)),
          ),
        ),
      );