use of com.netflix.zuul.message.http.HttpRequestMessageImpl in project zuul by Netflix.
the class ClientRequestReceiverTest method parseUriFromNetty_unknown.
@Test
public void parseUriFromNetty_unknown() {
EmbeddedChannel channel = new EmbeddedChannel(new ClientRequestReceiver(null));
channel.attr(SourceAddressChannelHandler.ATTR_SERVER_LOCAL_PORT).set(1234);
HttpRequestMessageImpl result;
{
channel.writeInbound(new DefaultFullHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.POST, "asdf", Unpooled.buffer()));
result = channel.readInbound();
result.disposeBufferedBody();
}
assertEquals("asdf", result.getPath());
channel.close();
}
use of com.netflix.zuul.message.http.HttpRequestMessageImpl in project zuul by Netflix.
the class ClientRequestReceiverTest method parseQueryParamsWithEncodedCharsInURI.
@Test
public void parseQueryParamsWithEncodedCharsInURI() {
EmbeddedChannel channel = new EmbeddedChannel(new ClientRequestReceiver(null));
channel.attr(SourceAddressChannelHandler.ATTR_SERVER_LOCAL_PORT).set(1234);
HttpRequestMessageImpl result;
{
channel.writeInbound(new DefaultFullHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.POST, "/foo/bar/somePath/%5E1.0.0?param1=foo¶m2=bar¶m3=baz", Unpooled.buffer()));
result = channel.readInbound();
result.disposeBufferedBody();
}
assertEquals("foo", result.getQueryParams().getFirst("param1"));
assertEquals("bar", result.getQueryParams().getFirst("param2"));
assertEquals("baz", result.getQueryParams().getFirst("param3"));
channel.close();
}
use of com.netflix.zuul.message.http.HttpRequestMessageImpl in project zuul by Netflix.
the class ClientRequestReceiverTest method largeResponse_atLimit.
@Test
public void largeResponse_atLimit() {
ClientRequestReceiver receiver = new ClientRequestReceiver(null);
EmbeddedChannel channel = new EmbeddedChannel(receiver);
// Required for messages
channel.attr(SourceAddressChannelHandler.ATTR_SERVER_LOCAL_PORT).set(1234);
int maxSize;
// Figure out the max size, since it isn't public.
{
ByteBuf buf = Unpooled.buffer(1).writeByte('a');
channel.writeInbound(new DefaultFullHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.POST, "/post", buf));
HttpRequestMessageImpl res = channel.readInbound();
maxSize = res.getMaxBodySize();
res.disposeBufferedBody();
}
HttpRequestMessageImpl result;
{
ByteBuf buf = Unpooled.buffer(maxSize);
buf.writerIndex(maxSize);
channel.writeInbound(new DefaultFullHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.POST, "/post", buf));
result = channel.readInbound();
result.disposeBufferedBody();
}
assertNull(result.getContext().getError());
assertFalse(result.getContext().shouldSendErrorResponse());
channel.close();
}
use of com.netflix.zuul.message.http.HttpRequestMessageImpl in project zuul by Netflix.
the class ClientRequestReceiverTest method parseUriFromNetty_relative.
@Test
public void parseUriFromNetty_relative() {
EmbeddedChannel channel = new EmbeddedChannel(new ClientRequestReceiver(null));
channel.attr(SourceAddressChannelHandler.ATTR_SERVER_LOCAL_PORT).set(1234);
HttpRequestMessageImpl result;
{
channel.writeInbound(new DefaultFullHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.POST, "/foo/bar/somePath/%5E1.0.0?param1=foo¶m2=bar¶m3=baz", Unpooled.buffer()));
result = channel.readInbound();
result.disposeBufferedBody();
}
assertEquals("/foo/bar/somePath/%5E1.0.0", result.getPath());
channel.close();
}
use of com.netflix.zuul.message.http.HttpRequestMessageImpl in project zuul by Netflix.
the class ClientRequestReceiverTest method parseUriFromNetty_absolute.
@Test
public void parseUriFromNetty_absolute() {
EmbeddedChannel channel = new EmbeddedChannel(new ClientRequestReceiver(null));
channel.attr(SourceAddressChannelHandler.ATTR_SERVER_LOCAL_PORT).set(1234);
HttpRequestMessageImpl result;
{
channel.writeInbound(new DefaultFullHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.POST, "https://www.netflix.com/foo/bar/somePath/%5E1.0.0?param1=foo¶m2=bar¶m3=baz", Unpooled.buffer()));
result = channel.readInbound();
result.disposeBufferedBody();
}
assertEquals("/foo/bar/somePath/%5E1.0.0", result.getPath());
channel.close();
}
Aggregations