@@ -59,7 +59,7 @@ class MethodReader {
5959 this .bean = bean ;
6060 this .beanPath = bean .getPath ();
6161 this .element = element ;
62- this .isVoid = element .getReturnType ().toString (). equals ( "void" ) ;
62+ this .isVoid = element .getReturnType ().getKind () == TypeKind . VOID ;
6363 this .methodRoles = Util .findRoles (element );
6464 this .javadoc = Javadoc .parse (ctx .getDocComment (element ));
6565 this .produces = produces (bean );
@@ -142,11 +142,11 @@ void addMeta(ProcessingContext ctx) {
142142 response .setDescription (javadoc .getReturnDescription ());
143143
144144 TypeMirror returnType = element .getReturnType ();
145- if (isNoResponse ( returnType ) ) {
145+ if (isVoid ) {
146146 if (isEmpty (response .getDescription ())) {
147147 response .setDescription ("No content" );
148148 }
149- responses .addApiResponse ("204" , response );
149+ responses .addApiResponse (Integer . toString ( httpStatusCode ()) , response );
150150 } else {
151151 responses .addApiResponse (ApiResponses .DEFAULT , response );
152152 String contentMediaType = (produces == null ) ? MediaType .APPLICATION_JSON : produces ;
@@ -159,10 +159,6 @@ private boolean isEmpty(String value) {
159159 return value == null || value .isEmpty ();
160160 }
161161
162- private boolean isNoResponse (TypeMirror returnType ) {
163- return returnType .getKind () == TypeKind .VOID ;
164- }
165-
166162 /**
167163 * Return true if the method is included in documentation.
168164 */
@@ -241,7 +237,7 @@ private List<String> roles() {
241237 }
242238
243239 private int httpStatusCode () {
244- return webMethod .statusCode ();
240+ return webMethod .statusCode (isVoid );
245241 }
246242
247243 private boolean isReturnContent () {
0 commit comments