Correctly detect Optional return type for @HttpExchange methods

Prior to this commit, a ClassCastException was thrown for an Optional
return type for an @HttpExchange method. This is because the check for
an Optional return type was based on the type contained in the Optional
instead of the Optional itself.

Closes gh-28493
This commit is contained in:
wonwoo
2022-05-20 13:31:52 +09:00
committed by Sam Brannen
parent 9487e8ce1e
commit 9181ac70f5
2 changed files with 9 additions and 1 deletions

View File

@@ -324,7 +324,7 @@ final class HttpServiceMethod {
responseFunction = initBodyFunction(client, actualParam, reactiveAdapter);
}
boolean blockForOptional = actualType.equals(Optional.class);
boolean blockForOptional = returnType.equals(Optional.class);
return new ResponseFunction(responseFunction, reactiveAdapter, blockForOptional, blockTimeout);
}