FINERACT-2568: Remove unnecessary @Consumes annotations from GET and DELETE endpoints#5715
Open
rhopman wants to merge 1 commit intoapache:developfrom
Open
FINERACT-2568: Remove unnecessary @Consumes annotations from GET and DELETE endpoints#5715rhopman wants to merge 1 commit intoapache:developfrom
rhopman wants to merge 1 commit intoapache:developfrom
Conversation
…DELETE endpoints
Contributor
Author
|
I realize this PR affects a large number of files, but since it's all the same issue, it didn't make sense to me to split it up. If this is not the preferred approach, please provide guidance. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
HTTP
GETandDELETEoperations typically do not accept a request body. However, many JAX-RS API resource classes in the codebase annotate these methods with@Consumes({ MediaType.APPLICATION_JSON }). This is misleading, as it implies the endpoint expects a request body when it does not. It can also result in unexpected415 Unsupported Media Typeresponses onDELETErequests where theContent-Typeheader is not set.There are two variants of this issue:
@Consumesis placed directly on@GETor@DELETEmethods that have no body parameter.@Consumesis placed on the class, which causes it to apply to all methods, including@GETand@DELETEmethods that should not have it.This PR:
@Consumes({ MediaType.APPLICATION_JSON })from all@GETmethods (they never accept a body).@Consumes({ MediaType.APPLICATION_JSON })from@DELETEmethods that do not accept a body parameter.@Consumesannotations on classes that contain@GETor@DELETEmethods: removes the class-level annotation and add@Consumesto each individual@POST/@PUTmethod that needs it.EchoHeadersApiResourceuses@Consumes({ MediaType.WILDCARD })on a@GETintentionally and is therefor not modified.Checklist