Created
March 17, 2023 05:13
-
-
Save vkostyukov/0617aa516edb3467240d5ec518e556c0 to your computer and use it in GitHub Desktop.
Armeria Bug
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
test("requestLog never completed with empty streaming response") { | |
import scala.concurrent.ExecutionContext.Implicits.global | |
val closed = new AtomicBoolean(false) | |
val service = new HttpService { | |
override def serve(ctx: ServiceRequestContext, req: HttpRequest): HttpResponse = { | |
val rep = HttpResponse.streaming() | |
rep.close() | |
rep | |
} | |
} | |
val server = Server.builder() | |
.port(0, SessionProtocol.HTTP) | |
.decorator { (d, ctx, r) => | |
ctx.log().whenComplete().toScala.onComplete { _ => | |
closed.set(true) | |
} | |
d.serve(ctx, r) | |
} | |
.serviceUnder("/empty", service) | |
.build() | |
Await.ready(server.start().toScala, 100.seconds) | |
val uri = s"h2://localhost:${server.activeLocalPort()}" | |
val client = WebClient | |
.builder(uri) | |
.build() | |
val req = HttpRequest.of(HttpMethod.GET, "/empty/") | |
Await.ready(client.execute(req).aggregate().toScala, 100.seconds) | |
assert(closed.get() == true) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment