Skip to content

Commit f676a89

Browse files
committed
Returns status code which defined at Response Object
1 parent 7d58f30 commit f676a89

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

modules/openapi-generator/src/main/resources/JavaSpring/methodBody.mustache

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{{^reactive}}
2+
int statusCode = {{#responses}}{{#-first}}{{{code}}}{{/-first}}{{/responses}};
23
{{#examples}}
34
{{#-first}}
45
{{#jdk8}}
@@ -16,7 +17,7 @@ return CompletableFuture.supplyAsync(()-> {
1617
{{#jdk8}}
1718
{{#async}} {{/async}} });
1819
{{/jdk8}}
19-
{{#async}} {{/async}} return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
20+
{{#async}} {{/async}} return new ResponseEntity<>(HttpStatus.valueOf(statusCode));
2021
{{#jdk8}}
2122
{{#async}}
2223
}, Runnable::run);
@@ -25,11 +26,11 @@ return CompletableFuture.supplyAsync(()-> {
2526
{{/-last}}
2627
{{/examples}}
2728
{{^examples}}
28-
return {{#jdk8}}{{#async}}CompletableFuture.completedFuture({{/async}}{{/jdk8}}new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED){{#jdk8}}{{#async}}){{/async}}{{/jdk8}};
29+
return {{#jdk8}}{{#async}}CompletableFuture.completedFuture({{/async}}{{/jdk8}}new ResponseEntity<>(HttpStatus.valueOf(statusCode)){{#jdk8}}{{#async}}){{/async}}{{/jdk8}};
2930
{{/examples}}
3031
{{/reactive}}
3132
{{#reactive}}
32-
exchange.getResponse().setStatusCode(HttpStatus.NOT_IMPLEMENTED);
33+
exchange.getResponse().setStatusCode(HttpStatus.valueOf(statusCode));
3334
Mono<Void> result = Mono.empty();
3435
{{#examples}}
3536
{{#-first}}

0 commit comments

Comments
 (0)