MCPcopy Create free account
hub / github.com/grpc/grpc-java / getHeaderValue

Method getHeaderValue

xds/src/main/java/io/grpc/xds/RoutingUtils.java:174–190  ·  view source on GitHub ↗
(Metadata headers, String headerName)

Source from the content-addressed store, hash-verified

172 }
173
174 @Nullable
175 private static String getHeaderValue(Metadata headers, String headerName) {
176 if (headerName.endsWith(Metadata.BINARY_HEADER_SUFFIX)) {
177 return null;
178 }
179 if (headerName.equals("content-type")) {
180 return "application/grpc";
181 }
182 Metadata.Key<String> key;
183 try {
184 key = Metadata.Key.of(headerName, Metadata.ASCII_STRING_MARSHALLER);
185 } catch (IllegalArgumentException e) {
186 return null;
187 }
188 Iterable<String> values = headers.getAll(key);
189 return values == null ? null : Joiner.on(",").join(values);
190 }
191}

Callers 1

matchRouteMethod · 0.95

Calls 4

endsWithMethod · 0.45
equalsMethod · 0.45
ofMethod · 0.45
getAllMethod · 0.45

Tested by

no test coverage detected