-
Notifications
You must be signed in to change notification settings - Fork 801
Adds support for optional request body Fixes gh-126 #263
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
Adds support for optional request body Fixes gh-126 #263
Conversation
Codecov Report
@@ Coverage Diff @@
## master #263 +/- ##
============================================
- Coverage 79.09% 77.15% -1.94%
- Complexity 351 373 +22
============================================
Files 42 51 +9
Lines 1320 1497 +177
Branches 202 219 +17
============================================
+ Hits 1044 1155 +111
- Misses 190 246 +56
- Partials 86 96 +10
|
@@ -147,6 +150,11 @@ else if (messageConverter instanceof ProtobufHttpMessageConverter | |||
} | |||
throw new EncodeException(message); | |||
} | |||
else { | |||
if (OPTIONAL_REQUEST_BODY.equals(request.bodyTemplate())) { |
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.
Is there any way to do this without a fake template body?
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.
Not one that I can see at the request level.
I think it could be done ate the Client level, not sure if we would want to go that broad for this.
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.
The empty template is sort of a workaround, indeed. If that was the only option, I would probably still like to go with this, however, this PR was closed for lack of tests and feedback and not because the functionality proposal was rejected. If that gets merged, we could then reuse it on Contract level, without the workaround. @matt62king let me know if you would like to try amending that OpenFeign PR and getting it merged? If not, I can work on it with the OpenFeign team.
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.
@OlgaMaciaszek I don't think I will be working the OpenFeign PR. I have not worked with that project before.
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.
ok @matt62king . Will try to submit sth like that to them.
…gn into optional-request-body-processor
Have created another issue in OpenFeign: OpenFeign/feign#1383. |
Adds support for
@RequestBody(required = false)
When request body is optional and null, encoder will add an empty body by default.
Fixes gh-126