Esc

set_initial_metadata

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

Replaces application response metadata before the first send or handler return. Entries are copied by the exchange; the caller may immediately release them. Invalid metadata leaves the previous block intact. Client calls and committed response headers return FAILED_PRECONDITION without cancelling the RPC. .

Signature

set_initial_metadata :: (call: *Call, entries: [] Metadata_Entry) -> Status
Example
reply :: (call: *Call, data: *void) -> Status {
    status := set_initial_metadata(call, Metadata_Entry.[.{ "x-id", "123" }]);
    if status.code != .OK return status;
    return send_bytes(call, u8.[1]);
}

See also