postBytes method

Future<CoapResponse> postBytes(
  1. String path, {
  2. required Uint8Buffer payload,
  3. CoapMediaType? format,
  4. CoapMediaType? accept,
  5. bool confirmable = true,
  6. List<Option<Object?>>? options,
  7. bool earlyBlock2Negotiation = false,
  8. int maxRetransmit = 0,
  9. CoapMulticastResponseHandler? onMulticastResponse,
})

Sends a POST request with the specified byte payload.

Implementation

Future<CoapResponse> postBytes(
  final String path, {
  required final Uint8Buffer payload,
  final CoapMediaType? format,
  final CoapMediaType? accept,
  final bool confirmable = true,
  final List<Option<Object?>>? options,
  final bool earlyBlock2Negotiation = false,
  final int maxRetransmit = 0,
  final CoapMulticastResponseHandler? onMulticastResponse,
}) {
  final request = CoapRequest.newPost(confirmable: confirmable)
    ..setPayloadMediaRaw(payload, format);
  _build(
    request,
    path,
    accept,
    options,
    earlyBlock2Negotiation,
    maxRetransmit,
  );
  return send(request, onMulticastResponse: onMulticastResponse);
}