Class RequestHeaders

java.lang.Object
io.qdrant.client.RequestHeaders

public final class RequestHeaders extends Object
Utilities for attaching per-request headers to gRPC calls.

 Context ctx = RequestHeaders.withHeader(Context.current(), "x-request-id", "abc-123");
 ctx.run(() -> client.listCollectionsAsync());
 
  • Method Summary

    Modifier and Type
    Method
    Description
    static io.grpc.Context
    withHeader(io.grpc.Context ctx, String key, String value)
    Returns a new Context that carries key/value as a gRPC metadata header on every request started within that context.
    static io.grpc.Context
    withHeaders(io.grpc.Context ctx, Map<String,String> headers)
    Returns a new Context that carries all entries of headers as gRPC metadata on every request started within that context.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • withHeader

      public static io.grpc.Context withHeader(io.grpc.Context ctx, String key, String value)
      Returns a new Context that carries key/value as a gRPC metadata header on every request started within that context.
      Parameters:
      ctx - the parent context
      key - the header name
      value - the header value
      Returns:
      a child context with the header attached
    • withHeaders

      public static io.grpc.Context withHeaders(io.grpc.Context ctx, Map<String,String> headers)
      Returns a new Context that carries all entries of headers as gRPC metadata on every request started within that context.
      Parameters:
      ctx - the parent context
      headers - the headers to attach
      Returns:
      a child context with the headers attached