0

Is there a Mock public Api website that returns a reactive response. Like a Stream of Items instead of a List of items. like we have jsonplaceholder.typicode.com which is non reactive version

ThrowableException
  • 1,168
  • 1
  • 8
  • 29
  • I'm not sure what is wrong with using a Reactor `HttpClient` against that HTTP service: https://github.com/reactor/reactor-netty. I think it doesn't matter what server does since there is the same HTTP protocol in between. – Artem Bilan Mar 17 '23 at 19:26
  • It does matter, if you expect a flux of items and just get a list of items the conversion to Item from String will break, because the chunks will not be based upon items – ThrowableException Mar 17 '23 at 19:37
  • @ArtemBilan if you run this code on this public api, and observer what’s printed you’ll uderstand what I’m talking about `HttpClient.create().get().uri("https://jsonplaceholder.typicode.com/photos").responseContent().asString().map(e -> {System.out.println(“chuck - [[[ “+e+”]]]" ); return e; });` – ThrowableException Mar 17 '23 at 19:40
  • I don't think the `Flux` server would help you somehow. See more about that `responseContent()`. It does return a `ByteBufFlux` of chunks based on some available bytes. You have to re-assemble items yourself. Something similar what WebFlux `WebClient` does with its `bodyToFlux()`. As I said before: on the HTTP network level it is just a sequence of bytes. – Artem Bilan Mar 20 '23 at 13:05

0 Answers0