use of org.apache.flink.shaded.netty4.io.netty.handler.codec.http.HttpHeaders in project netty by netty.
the class HttpConversionUtilTest method stripConnectionHeadersAndNominees.
@Test
public void stripConnectionHeadersAndNominees() {
HttpHeaders inHeaders = new DefaultHttpHeaders();
inHeaders.add(CONNECTION, "foo");
inHeaders.add("foo", "bar");
Http2Headers out = new DefaultHttp2Headers();
HttpConversionUtil.toHttp2Headers(inHeaders, out);
assertTrue(out.isEmpty());
}
use of org.apache.flink.shaded.netty4.io.netty.handler.codec.http.HttpHeaders in project netty by netty.
the class HttpConversionUtilTest method connectionSpecificHeadersShouldBeRemoved.
@Test
public void connectionSpecificHeadersShouldBeRemoved() {
HttpHeaders inHeaders = new DefaultHttpHeaders();
inHeaders.add(CONNECTION, "keep-alive");
inHeaders.add(HOST, "example.com");
@SuppressWarnings("deprecation") AsciiString keepAlive = KEEP_ALIVE;
inHeaders.add(keepAlive, "timeout=5, max=1000");
@SuppressWarnings("deprecation") AsciiString proxyConnection = PROXY_CONNECTION;
inHeaders.add(proxyConnection, "timeout=5, max=1000");
inHeaders.add(TRANSFER_ENCODING, "chunked");
inHeaders.add(UPGRADE, "h2c");
Http2Headers outHeaders = new DefaultHttp2Headers();
HttpConversionUtil.toHttp2Headers(inHeaders, outHeaders);
assertFalse(outHeaders.contains(CONNECTION));
assertFalse(outHeaders.contains(HOST));
assertFalse(outHeaders.contains(keepAlive));
assertFalse(outHeaders.contains(proxyConnection));
assertFalse(outHeaders.contains(TRANSFER_ENCODING));
assertFalse(outHeaders.contains(UPGRADE));
}
use of org.apache.flink.shaded.netty4.io.netty.handler.codec.http.HttpHeaders in project netty by netty.
the class HttpConversionUtilTest method stripTEHeadersExcludingTrailers.
@Test
public void stripTEHeadersExcludingTrailers() {
HttpHeaders inHeaders = new DefaultHttpHeaders();
inHeaders.add(TE, GZIP);
inHeaders.add(TE, TRAILERS);
Http2Headers out = new DefaultHttp2Headers();
HttpConversionUtil.toHttp2Headers(inHeaders, out);
assertSame(TRAILERS, out.get(TE));
}
use of org.apache.flink.shaded.netty4.io.netty.handler.codec.http.HttpHeaders in project netty by netty.
the class HttpConversionUtilTest method addHttp2ToHttpHeadersCombinesCookies.
@Test
public void addHttp2ToHttpHeadersCombinesCookies() throws Http2Exception {
Http2Headers inHeaders = new DefaultHttp2Headers();
inHeaders.add("yes", "no");
inHeaders.add(COOKIE, "foo=bar");
inHeaders.add(COOKIE, "bax=baz");
HttpHeaders outHeaders = new DefaultHttpHeaders();
HttpConversionUtil.addHttp2ToHttpHeaders(5, inHeaders, outHeaders, HttpVersion.HTTP_1_1, false, false);
assertEquals("no", outHeaders.get("yes"));
assertEquals("foo=bar; bax=baz", outHeaders.get(COOKIE.toString()));
}
use of org.apache.flink.shaded.netty4.io.netty.handler.codec.http.HttpHeaders in project netty by netty.
the class HttpConversionUtilTest method http2ToHttpHeaderTest.
@Test
public void http2ToHttpHeaderTest() throws Exception {
Http2Headers http2Headers = new DefaultHttp2Headers();
http2Headers.status("200");
// HTTP/2 Header response should not contain 'path' in response.
http2Headers.path("/meow");
http2Headers.set("cat", "meow");
HttpHeaders httpHeaders = new DefaultHttpHeaders();
HttpConversionUtil.addHttp2ToHttpHeaders(3, http2Headers, httpHeaders, HttpVersion.HTTP_1_1, false, true);
assertFalse(httpHeaders.contains(HttpConversionUtil.ExtensionHeaderNames.PATH.text()));
assertEquals("meow", httpHeaders.get("cat"));
httpHeaders.clear();
HttpConversionUtil.addHttp2ToHttpHeaders(3, http2Headers, httpHeaders, HttpVersion.HTTP_1_1, false, false);
assertTrue(httpHeaders.contains(HttpConversionUtil.ExtensionHeaderNames.PATH.text()));
assertEquals("meow", httpHeaders.get("cat"));
}
Aggregations