Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using text/event-stream in Intellij HTTP Client

I have Spring based Java application with a REST controller which returns Project-Reactor's Flux type. The MediaType this GET endpoint returns is TEXT_EVENT_STREAM_VALUE.

To be clearer on the matter, the endpoint looks a little as follows, omitting the actual operation to return as it's not important:

@GetMapping(value = "/sample", produces = MediaType.TEXT_EVENT_STREAM_VALUE)
public Flux<Sample> getSampleFlux() {
    return /* A Flux containing Sample */
}

This bit of code works, as when I call it from my code or through for example Chrome using the endpoint, the results are streamed through as desired.

However, I wanted to test this behavior with Intellij's HTTP Client. To this end, I created the following operation in a *.http file in my project:

GET localhost:8080/sample
Accept: text/event-stream
###

Running it works from within Intellij, but nothing is returned, ever.

Can anybody tell me what I am missing here? I am likely wrongfully using the HTTP Client, but I can't find any clear samples from other people trying to do something similar.

like image 363
Steven Avatar asked May 17 '26 15:05

Steven


1 Answers

Apparently, it was fixed in 2021.3: https://youtrack.jetbrains.com/issue/IDEA-239328

like image 130
Hérisson Avatar answered May 20 '26 10:05

Hérisson



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!