Comments (10)
square/okhttp#7005 is about request body not response body.
https://github.com/square/retrofit/blob/master/retrofit/src/main/java/retrofit2/Response.java#L151 response body are always nullable
i will made some tests
from retrofit-adapters.
@xanscale Thanks for your contribution. It will be contained in the next release!
from retrofit-adapters.
Hey @xanscale, I'm a little bit confused about the terminology. Do you mean the empty body (Code 200 responses, right?)
from retrofit-adapters.
Additionally, what are the benefits of using a nullable body over the Unit
type for the empty body?
from retrofit-adapters.
i have a service that can return body or not, in detail
- 200 with body
- 204 without body
Unit are used when you know that there is no body (or you dont care on it)
with my PR it works with both Foo?
and Unit
.
Unit
can be used in caso of there isn't body or don't care about bodyFoo?
can be used in case of optional body
from retrofit-adapters.
@xanscale Btw is there a meaningful difference between an empty body and a nobody?
from retrofit-adapters.
@skydoves response body are OPTIONAL! same call can be with response body or not based on USER status.
from retrofit-adapters.
@xanscale I'm unsure if #18 works well because fundamentally OkHttp doesn't support NULL body yet: square/okhttp#7005.
And can we build any unit test cases for the nullable body similar to this? https://github.com/skydoves/retrofit-adapters/blob/main/retrofit-adapters-result/src/test/kotlin/com/skydoves/retrofit/adapters/result/ResultCallTest.kt#L87
from retrofit-adapters.
I got it. Thanks for the details!
from retrofit-adapters.
pushed unit test
from retrofit-adapters.
Related Issues (6)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from retrofit-adapters.