Inconsistency of HttpRequest interface factory methods #5195
Labels
info: good first issue
Good for newcomers
type: improvement
A minor improvement to an existing feature
Task List
Steps to Reproduce
null
as body.Expected Behaviour
It is possible to create a POST / PUT / PATCH HttpRequest instance with
null
body via interface factory methods. Use-case for this is to make sending of the POST / PUT / PATCH request with empty body via, for example, RxHttpClient possible. A workaround is to use empty string as body or build the request withHttpRequest.create()
(?).Actual Behaviour
NullPointerException
Argument [body] cannot be null
will be thrown. DELETE instance can be created withnull
body though.Notes
HttpRequest.getBody()
returnsOptional
, so enforcing non-null bodies looks excessive.Example Application
Not required, issue is obvious from the source code.
The text was updated successfully, but these errors were encountered: