diff --git a/ballerina-tests/http2-tests/tests/http2_configuration_request_limit_config_test.bal b/ballerina-tests/http2-tests/tests/http2_configuration_request_limit_config_test.bal index 83924c0dd3..6cba28c384 100644 --- a/ballerina-tests/http2-tests/tests/http2_configuration_request_limit_config_test.bal +++ b/ballerina-tests/http2-tests/tests/http2_configuration_request_limit_config_test.bal @@ -147,7 +147,7 @@ function testHttp2ValidHeaderLength() returns error? { //Tests the behaviour when header size is greater than the configured threshold // TODO: Enable after fixing this issue : https://github.com/ballerina-platform/ballerina-standard-library/issues/3963 @test:Config { - enable: false + enable: true } function testHttp2InvalidHeaderLength() returns error? { http:Client limitClient = check new ("http://localhost:" + http2RequestLimitsTestPort3.toString(), diff --git a/native/src/main/java/io/ballerina/stdlib/http/transport/contractimpl/common/states/Http2StateUtil.java b/native/src/main/java/io/ballerina/stdlib/http/transport/contractimpl/common/states/Http2StateUtil.java index e8ed1daf54..e72fd6ae8a 100644 --- a/native/src/main/java/io/ballerina/stdlib/http/transport/contractimpl/common/states/Http2StateUtil.java +++ b/native/src/main/java/io/ballerina/stdlib/http/transport/contractimpl/common/states/Http2StateUtil.java @@ -43,6 +43,7 @@ import io.netty.channel.ChannelFuture; import io.netty.channel.ChannelFutureListener; import io.netty.channel.ChannelHandlerContext; +import io.netty.channel.ChannelPromise; import io.netty.handler.codec.http.DefaultLastHttpContent; import io.netty.handler.codec.http.HttpContent; import io.netty.handler.codec.http.HttpHeaderNames; @@ -320,9 +321,13 @@ public static void writeHttp2Headers(ChannelHandlerContext ctx, OutboundMsgHolde return; } } - - encoder.writeHeaders(ctx, streamId, http2Headers, dependencyId, weight, false, 0, endStream, - ctx.newPromise()); + ChannelPromise promise = ctx.newPromise(); + encoder.writeHeaders(ctx, streamId, http2Headers, dependencyId, weight, false, 0, endStream, promise); + promise.addListener((ChannelFutureListener) channelFuture -> { + if (!channelFuture.isSuccess()) { + outboundMsgHolder.getResponseFuture().notifyHttpListener(channelFuture.cause()); + } + }); encoder.flowController().writePendingBytes(); ctx.flush();