setHttpHeaderTransform method

Future<CommandCompletion> setHttpHeaderTransform(
  1. HttpHeaderTransform transform
)

Adds headers to the runtime's HTTP requests.

The transform replaces the one set before. In a browser or on OpenHarmony, serve the requests with RuntimeHandle.setResourceProvider() instead.

See mln_runtime_set_http_header_transform in the C API reference.

Errors:

  • Status.unsupported when the library runs in a browser or on OpenHarmony.

Implementation

Future<CommandCompletion> setHttpHeaderTransform(
  HttpHeaderTransform transform,
) => _command((arena, completion) {
  final registrations = _NativeRegistrations(_callbackRoots);
  return registrations.run(
    () => raw.mln_runtime_set_http_header_transform(
      _handle.raw,
      registrations.add(_prepareHttpHeaderTransform(transform)),
      completion,
      nativeDiagnostic,
    ),
  );
});