-
Notifications
You must be signed in to change notification settings - Fork 59
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
[v3] Enable RestResponse<headers, Mono<TBody>> #564
Comments
@JonathanGiles as you pointed this is supported by .net (via |
the request will be initiated then RestResponse will be created and emitted from the returned response. |
The proxy interface looks like: @Host("http://httpbin.org")
private interface HttpBinService {
@PUT("put")
Mono<RestResponseBase<HttpBinHeaders,Mono<HttpBinJSON>>> putBodyAndHeadersAsyncContentAsync(@BodyParam(ContentType.APPLICATION_OCTET_STREAM) String body);
@PUT("put")
RestResponseBase<HttpBinHeaders,Mono<HttpBinJSON>> putBodyAndHeadersContentAsync(@BodyParam(ContentType.APPLICATION_OCTET_STREAM) String body);
} The usage looks like: Both response and body is asyncfinal Mono<RestResponseBase<HttpBinHeaders, Mono<HttpBinJSON>>> asyncResponse = createService(HttpBinService.class)
.putBodyAndHeadersAsyncContentAsync("body string");
//
asyncResponse.flatMap(response -> {
//
final Mono<HttpBinJSON> asyncBody = response.body();
return asyncBody.flatMap(body -> {
// "body string"
System.out.println(body.data);
return Mono.just(response.headers());
});
})
.doOnNext(hdrs -> {
final HttpBinHeaders headers = hdrs;
System.out.println(headers.connection.toLowerCase());
})
.block(); response is sync and body is asyncfinal RestResponseBase<HttpBinHeaders, Mono<HttpBinJSON>> response = createService(HttpBinService.class)
.putBodyAndHeadersContentAsync("body string");
//
final Mono<HttpBinJSON> asyncBody = response.body();
asyncBody.doOnNext(body -> {
// "body string"
System.out.println(body.data);
})
.block();
final HttpBinHeaders headers = response.headers();
System.out.println(headers.connection.toLowerCase()); |
The DecodedResponse has the capability to emit lazy decoded body, bubble up this to RestResponseBase level so that we can support
RestResponseBase<..., Mono<TBody>>
The text was updated successfully, but these errors were encountered: