Package io.grpc.stub
Class MetadataUtils
java.lang.Object
io.grpc.stub.MetadataUtils
Utility functions for binding and receiving headers.
-
Method Summary
Modifier and TypeMethodDescriptionstatic ClientInterceptornewAttachHeadersInterceptor(Metadata extraHeaders) Returns a client interceptor that attaches a set of headers to requests.static ClientInterceptornewCaptureMetadataInterceptor(AtomicReference<Metadata> headersCapture, AtomicReference<Metadata> trailersCapture) Captures the last received metadata on a channel.
-
Method Details
-
newAttachHeadersInterceptor
Returns a client interceptor that attaches a set of headers to requests.- Parameters:
extraHeaders- the headers to be passed by each call that is processed by the returned interceptor
-
newCaptureMetadataInterceptor
public static ClientInterceptor newCaptureMetadataInterceptor(AtomicReference<Metadata> headersCapture, AtomicReference<Metadata> trailersCapture) Captures the last received metadata on a channel. Useful for testing.- Parameters:
headersCapture- to record the last received headerstrailersCapture- to record the last received trailers- Returns:
- an implementation of the channel with captures installed.
-