-
-
Notifications
You must be signed in to change notification settings - Fork 7.5k
[Spring] Add an option to return success code #1197
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
Changes from all commits
f676a89
ba2cedc
acff51c
95b6a00
df17007
d3731ee
27a4e2b
2e4f484
4ade38a
a1b793b
a758b1d
bd7ee46
73a88d8
048fcf1
4af665d
8dedb43
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -16,7 +16,7 @@ return CompletableFuture.supplyAsync(()-> { | |
| {{#jdk8}} | ||
| {{#async}} {{/async}} }); | ||
| {{/jdk8}} | ||
| {{#async}} {{/async}} return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); | ||
| {{#async}} {{/async}} return new ResponseEntity<>({{#returnSuccessCode}}HttpStatus.valueOf({{{statusCode}}}){{/returnSuccessCode}}{{^returnSuccessCode}}HttpStatus.NOT_IMPLEMENTED{{/returnSuccessCode}}); | ||
| {{#jdk8}} | ||
| {{#async}} | ||
| }, Runnable::run); | ||
|
|
@@ -25,14 +25,14 @@ return CompletableFuture.supplyAsync(()-> { | |
| {{/-last}} | ||
| {{/examples}} | ||
| {{^examples}} | ||
| return {{#jdk8}}{{#async}}CompletableFuture.completedFuture({{/async}}{{/jdk8}}new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED){{#jdk8}}{{#async}}){{/async}}{{/jdk8}}; | ||
| return {{#jdk8}}{{#async}}CompletableFuture.completedFuture({{/async}}{{/jdk8}}new ResponseEntity<>({{#returnSuccessCode}}HttpStatus.OK{{/returnSuccessCode}}{{^returnSuccessCode}}HttpStatus.NOT_IMPLEMENTED{{/returnSuccessCode}}){{#jdk8}}{{#async}}){{/async}}{{/jdk8}}; | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Shouldn't it be |
||
| {{/examples}} | ||
| {{/reactive}} | ||
| {{#reactive}} | ||
| exchange.getResponse().setStatusCode(HttpStatus.NOT_IMPLEMENTED); | ||
| Mono<Void> result = Mono.empty(); | ||
| Mono<Void> result = Mono.empty(); | ||
| {{#examples}} | ||
| {{#-first}} | ||
| exchange.getResponse().setStatusCode({{#returnSuccessCode}}HttpStatus.valueOf({{{statusCode}}}){{/returnSuccessCode}}{{^returnSuccessCode}}HttpStatus.NOT_IMPLEMENTED{{/returnSuccessCode}}); | ||
| for (MediaType mediaType : exchange.getRequest().getHeaders().getAccept()) { | ||
| {{/-first}} | ||
| if (mediaType.isCompatibleWith(MediaType.valueOf("{{{contentType}}}"))) { | ||
|
|
@@ -43,5 +43,8 @@ exchange.getResponse().setStatusCode(HttpStatus.NOT_IMPLEMENTED); | |
| } | ||
| {{/-last}} | ||
| {{/examples}} | ||
| {{^examples}} | ||
| exchange.getResponse().setStatusCode({{#returnSuccessCode}}HttpStatus.OK{{/returnSuccessCode}}{{^returnSuccessCode}}HttpStatus.NOT_IMPLEMENTED{{/returnSuccessCode}}); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Shouldn't it be
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, it should be |
||
| {{/examples}} | ||
| return result.then(Mono.empty()); | ||
| {{/reactive}} | ||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
methodResponseis "2xx" or "default" soexampleStatusCodewill be 2xx.