use of io.netty.handler.codec.http.DefaultHttpHeaders in project tesla by linking12.
the class HttpRequestFilter method createResponse.
protected HttpResponse createResponse(HttpResponseStatus httpResponseStatus, HttpRequest originalRequest) {
HttpHeaders httpHeaders = new DefaultHttpHeaders();
httpHeaders.add("Transfer-Encoding", "chunked");
HttpResponse httpResponse = new DefaultFullHttpResponse(HttpVersion.HTTP_1_1, httpResponseStatus);
List<String> originHeader = FilterUtil.getHeaderValues(originalRequest, "Origin");
if (originHeader.size() > 0) {
httpHeaders.set("Access-Control-Allow-Credentials", "true");
httpHeaders.set("Access-Control-Allow-Origin", originHeader.get(0));
}
httpResponse.headers().add(httpHeaders);
return httpResponse;
}
Aggregations