HttpClient: consider adding an HttpResponse::map method to map an HttpResponse<T> to an HttpResponse<U>

XMLWordPrintable

    • Type: Enhancement
    • Resolution: Unresolved
    • Priority: P4
    • tbd
    • Affects Version/s: None
    • Component/s: core-libs

      We should consider to introduce a new AP method:

          `<U> HttpResponse<U> HttpResponse::map(Function<T,U> mapper);`

      This way we could also promote the following:

          HttpResponse<W> resp =
               client.sendAsync(req, BodySubscribers.ofInputStream())
                    .thenApplyAsync(r -> r.map(toJSON(W.class, r.body()))
                    .join();

      This would allow the caller to decide whether to performed the mapping in a synchronous or asynchronous dependent action, as well as allowing him to supply an executor if he so wishes.

            Assignee:
            Chris Hegarty
            Reporter:
            Daniel Fuchs
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: