Skip to content

Instantly share code, notes, and snippets.

@ezarko
Created February 8, 2018 22:55
Show Gist options
  • Save ezarko/0163c23a1c3c1f709ccb0561895a6de8 to your computer and use it in GitHub Desktop.
Save ezarko/0163c23a1c3c1f709ccb0561895a6de8 to your computer and use it in GitHub Desktop.
Given an HttpServletRequest named request, creates a Map<String, String> of the headers.
Map<String, String> headers = Collections.list(request.getHeaderNames()).stream().collect(Collectors.toMap(Function.identity(), n -> request.getHeader(n)));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment