CorsConfig { public Set<String> allowedRequestHeaders() { return Collections.unmodifiableSet(allowedRequestHeaders); } CorsConfig(final CorsConfigBuilder builder); boolean isCorsSupportEnabled(); boolean isAnyOriginSupported(); String origin(); Set<String> origins(); boolean isNullOriginAllowed(); Set<String> exposedHeaders(); boolean isCredentialsAllowed(); long maxAge(); Set<HttpMethod> allowedRequestMethods(); Set<String> allowedRequestHeaders(); HttpHeaders preflightResponseHeaders(); boolean isShortCircuit(); @Deprecated boolean isShortCurcuit(); @Override String toString(); @Deprecated static Builder withAnyOrigin(); @Deprecated static Builder withOrigin(final String origin); @Deprecated static Builder withOrigins(final String... origins);  }
@Test public void requestHeaders() { final CorsConfig cors = forAnyOrigin().allowedRequestHeaders("preflight-header1", "preflight-header2").build(); assertThat(cors.allowedRequestHeaders(), hasItems("preflight-header1", "preflight-header2")); }