Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support reactive/future HTTP client bodies #11547

Open
wants to merge 1 commit into
base: 4.8.x
Choose a base branch
from
Open

Support reactive/future HTTP client bodies #11547

wants to merge 1 commit into from

Conversation

dstepanov
Copy link
Contributor

No description provided.

@dstepanov dstepanov added the type: improvement A minor improvement to an existing feature label Jan 28, 2025
@@ -894,16 +896,21 @@ private <I, O, E> Mono<HttpResponse<O>> exchange(io.micronaut.http.HttpRequest<I
AtomicReference<ScheduledExecutorService> scheduler = new AtomicReference<>(connectionManager.getGroup());
ExecutionFlow<HttpResponse<O>> mono = resolveRequestURI(request).flatMap(uri -> {
MutableHttpRequest<?> mutableRequest = toMutableRequest(request).uri(uri);
Object body = mutableRequest.getBody().orElse(null);
if (body instanceof Publisher<?> publisher) {
return ReactiveExecutionFlow.fromPublisher(publisher).flatMap(resolvedBody -> {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think Publisher support also needs multi-element support.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure how we should support it

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My vote is that we don't for now. Actually mirroring the server behavior is more complicated than this. But this implementation is not workable, e.g. @Body Publisher<byte[]> will support streaming on the server but not on the client.

@yawkat
Copy link
Member

yawkat commented Jan 28, 2025

I don't really see how this is useful for the single-element case, cant you just do body.onComplete(b->client.xyz(b)) instead of client.xyz(body) directly?

@dstepanov
Copy link
Contributor Author

The problem that I’m trying to use an interface API definition, controller works fine but the client is missing this.

@graemerocher
Copy link
Contributor

Are all the failures related?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: improvement A minor improvement to an existing feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants