Esc

initial_metadata

procedureextensionsince 0.36.1Source
  • macOS: initial_metadata works on macOS
  • Linux: initial_metadata works on Linux
  • Windows: initial_metadata works on Windows
  • Wasm: initial_metadata works on Wasm

Initial application metadata borrows call-owned storage until close. On clients it becomes available after the first receive has obtained response headers. .

Signature

initial_metadata :: (call: *Call) -> [] Metadata_Entry
Example
channel: Channel; // set transport.base_url and transport.tls before the first call
method := Method.{ path = "/echo.Echo/Say" };
call, status := open_call(*channel, method);
assert(status.code == .OK);
defer close(*call);
message, kind := receive_bytes(*call); // response headers arrive with the first receive
if kind == .MESSAGE free(message.data);
for initial_metadata(*call) print("%: %\n", it.name, it.value);

See also