Skip to content

Commit

Permalink
Remove unneeded check
Browse files Browse the repository at this point in the history
  • Loading branch information
dstepanov committed Nov 30, 2023
1 parent 40d65e8 commit 7ffd3d8
Showing 1 changed file with 1 addition and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@
import io.micronaut.http.netty.body.NettyBodyWriter;
import io.micronaut.http.netty.body.NettyWriteContext;
import io.micronaut.http.netty.stream.JsonSubscriber;
import io.micronaut.http.netty.stream.StreamedHttpRequest;
import io.micronaut.http.netty.stream.StreamedHttpResponse;
import io.micronaut.http.server.RouteExecutor;
import io.micronaut.http.server.binding.RequestArgumentSatisfier;
Expand All @@ -60,11 +59,9 @@
import io.netty.buffer.Unpooled;
import io.netty.channel.ChannelHandler.Sharable;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.http.DefaultFullHttpRequest;
import io.netty.handler.codec.http.DefaultFullHttpResponse;
import io.netty.handler.codec.http.DefaultHttpContent;
import io.netty.handler.codec.http.DefaultHttpHeaders;
import io.netty.handler.codec.http.FullHttpRequest;
import io.netty.handler.codec.http.FullHttpResponse;
import io.netty.handler.codec.http.HttpContent;
import io.netty.handler.codec.http.HttpResponseStatus;
Expand Down Expand Up @@ -189,28 +186,7 @@ public void handleUnboundError(Throwable cause) {

@Override
public void accept(ChannelHandlerContext ctx, io.netty.handler.codec.http.HttpRequest request, PipeliningServerHandler.OutboundAccess outboundAccess) {
NettyHttpRequest<Object> mnRequest;
try {
mnRequest = new NettyHttpRequest<>(request, ctx, conversionService, serverConfiguration);
} catch (IllegalArgumentException e) {
// invalid URI
NettyHttpRequest<Object> errorRequest = new NettyHttpRequest<>(
new DefaultFullHttpRequest(request.protocolVersion(), request.method(), "/", Unpooled.EMPTY_BUFFER),
ctx,
conversionService,
serverConfiguration
);
outboundAccess.attachment(errorRequest);
try (PropagatedContext.Scope ignore = PropagatedContext.getOrEmpty().plus(new ServerHttpRequestContext(errorRequest)).propagate()) {
new NettyRequestLifecycle(this, outboundAccess).handleException(errorRequest, e.getCause() == null ? e : e.getCause());
}
if (request instanceof StreamedHttpRequest streamed) {
streamed.closeIfNoSubscriber();
} else {
((FullHttpRequest) request).release();
}
return;
}
NettyHttpRequest<?> mnRequest = new NettyHttpRequest<>(request, ctx, conversionService, serverConfiguration);
outboundAccess.attachment(mnRequest);
try (PropagatedContext.Scope ignore = PropagatedContext.getOrEmpty().plus(new ServerHttpRequestContext(mnRequest)).propagate()) {
new NettyRequestLifecycle(this, outboundAccess).handleNormal(mnRequest);
Expand Down

0 comments on commit 7ffd3d8

Please sign in to comment.