List of usage examples for io.netty.handler.codec.http HttpHeaderNames ACCESS_CONTROL_EXPOSE_HEADERS
AsciiString ACCESS_CONTROL_EXPOSE_HEADERS
To view the source code for io.netty.handler.codec.http HttpHeaderNames ACCESS_CONTROL_EXPOSE_HEADERS.
Click Source Link
From source file:org.ballerinalang.net.http.CorsHeaderGenerator.java
License:Open Source License
private static void setExposedAllowedHeaders(CorsHeaders resCors, Map<String, String> respHeaders) { //TODO can cache concatenated expose headers in the resource. List<String> exposeHeaders = resCors.getExposeHeaders(); if (exposeHeaders == null) { return;//from w w w . j av a 2 s. c om } String exposeHeaderResponse = DispatcherUtil.concatValues(exposeHeaders, false); if (!exposeHeaderResponse.isEmpty()) { respHeaders.put(HttpHeaderNames.ACCESS_CONTROL_EXPOSE_HEADERS.toString(), exposeHeaderResponse); } }
From source file:org.ballerinalang.stdlib.services.cors.HTTPCorsTest.java
License:Open Source License
@Test(description = "Test for resource only CORS declaration") public void testSimpleReqResourceOnlyCors() { String path = "/hello2/test1"; HTTPTestRequest cMsg = MessageUtils.generateHTTPMessage(path, "POST", "hello"); cMsg.setHeader(HttpHeaderNames.ORIGIN.toString(), "http://www.hello.com"); HttpCarbonMessage response = Services.invokeNew(complieResult, TEST_EP, cMsg); Assert.assertNotNull(response);//from w w w . j a va 2s. c o m BValue bJson = JsonParser.parse(new HttpMessageDataStreamer(response).getInputStream()); Assert.assertEquals(((BMap<String, BValue>) bJson).get("echo").stringValue(), "resOnlyCors"); Assert.assertEquals("http://www.hello.com", response.getHeader(HttpHeaderNames.ACCESS_CONTROL_ALLOW_ORIGIN.toString())); Assert.assertEquals(null, response.getHeader(HttpHeaderNames.ACCESS_CONTROL_ALLOW_CREDENTIALS.toString())); Assert.assertEquals("X-Content-Type-Options, X-PINGOTHER", response.getHeader(HttpHeaderNames.ACCESS_CONTROL_EXPOSE_HEADERS.toString())); }