-
Notifications
You must be signed in to change notification settings - Fork 32
Open
Description
I am looking through the Java callout examples. I don't see a way for the Callout to see the method or path on the request.
Envoyproxy has "pseudo headers" of :path and :method, but I have not been able to retrieve values for them.
BTW is this really the simplest way to retrieve a header value?
private static String getHeader(HttpHeaders headers, String headerName) {
return headers.getHeaders().getHeadersList().stream()
.filter(header -> headerName.equalsIgnoreCase(header.getKey()))
.map(header -> new String(header.getRawValue().toByteArray(), StandardCharsets.UTF_8))
.findFirst()
.orElse(null);
}EDIT Check that. I had configured the service extension to receive only a specific set of headers. (Check this doc) . When I removed the forwardHeaders element, my Callout got all the headers, including the pseudo headers.
Still have a remaining question ... is that ^^ the correct way to get a single header?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels