Comments (4)
This is a tricky case. I think we should try to support 204 responses in the future, but cannot right now for two reasons:
- We can't tell that your
BlockDto?
type is nullable from java reflection alone (which is what retrofit uses) - Retrofit does not try converters for 204/205 response codes - square/retrofit#2867
The second one requires addressing in Retrofit, because we are just passing on the body from retrofit directly back to it and it throws the KNPE on its own null response body. It only natively supports null response bodies for Void
and Unit
(where it ignores them), so you could file a feature request upstream to support nullable types somehow. Fair warning though that is likely not possible right now due to the first mentioned bullet. It would require either reading @Nullable
type annotations or some degree of kotlin-reflect or kotlin metadata to properly parse the kotlin function signature.
You should either use Unit
or change your API to use something other than 204/205 for now.
from eithernet.
Adding to this a bit more - you should follow this issue square/retrofit#3075
from eithernet.
So currently there's no way we can handle 204 No content return type ?
from eithernet.
As explained at length in the comment above, no.
from eithernet.
Related Issues (19)
- Embed proguard rules? HOT 2
- [BUG]
- Support interop with other call adapters HOT 6
- [BUG] EitherNet + MultiDex + minSDK 19 HOT 1
- Unable to create converter for class com.slack.eithernet.ApiResult when using Nothing with Moshi HOT 10
- Integrate Kotlin ABI validator
- ClassCastException in ApiResultConverterFactory when minify is enabled
- Automatic snapshot publishing always skipped HOT 1
- [BUG] test fixtures do not seem to be published HOT 3
- enqueueFromJava does not handle inherited functions in lookups
- Consider making a recipes/samples subproject
- [BUG] Exception when looking for an annotation that doesn't exist HOT 1
- [FEATURE] Support declarative error model binding HOT 2
- [BUG] v1.3.0 published with invalid Gradle Module Metadata HOT 2
- (how) should we handle error bodies in 4xx responses? HOT 3
- Api<Unit, Throwable> crashes with NPE when http code is 204 or 205 HOT 3
- Retrofit converter for wrapped responses
- Add an escape hatch to retries
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 eithernet.