Skip to content

Commit

Permalink
Fix unwrap CompletionStage
Browse files Browse the repository at this point in the history
Signed-off-by: jansupol <[email protected]>
  • Loading branch information
jansupol authored and senivam committed Aug 16, 2022
1 parent 5f1bff8 commit e722b4a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,7 @@ private Response invoke(final RequestProcessingContext context, final Object res

private Type unwrapInvocableResponseType(ContainerRequest request, Type entityType) {
if (isCompletionStageResponseType
&& request.resolveProperty(ServerProperties.UNWRAP_COMPLETION_STAGE_IN_WRITER_ENABLE, Boolean.FALSE)) {
&& request.resolveProperty(ServerProperties.UNWRAP_COMPLETION_STAGE_IN_WRITER_ENABLE, Boolean.TRUE)) {
return isCompletionStageResponseResponseType ? entityType : completionStageResponseType;
}
return invocableResponseType;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,7 @@ public class CompletionStageTest extends JerseyTest {

@Override
protected Application configure() {
return new ResourceConfig(CompletionStageResource.class, DataBeanWriter.class)
.property(ServerProperties.UNWRAP_COMPLETION_STAGE_IN_WRITER_ENABLE, Boolean.TRUE);
return new ResourceConfig(CompletionStageResource.class, DataBeanWriter.class);
}

@Test
Expand Down Expand Up @@ -272,7 +271,6 @@ public CompletionStage<String> getCustomCompletionStage() {
@GET
@Path("/databeanlist")
public CompletionStage<List<DataBean>> getDataBeanList(@Context ContainerRequestContext requestContext) {
requestContext.setProperty(ServerProperties.UNWRAP_COMPLETION_STAGE_IN_WRITER_ENABLE, Boolean.TRUE);
return CompletableFuture.completedFuture(Collections.singletonList(new DataBean(ENTITY)));
}

Expand Down

0 comments on commit e722b4a

Please sign in to comment.