Git Product home page Git Product logo

Comments (4)

ZacSweers avatar ZacSweers commented on July 20, 2024

This is a tricky case. I think we should try to support 204 responses in the future, but cannot right now for two reasons:

  1. We can't tell that your BlockDto? type is nullable from java reflection alone (which is what retrofit uses)
  2. 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.

ZacSweers avatar ZacSweers commented on July 20, 2024

Adding to this a bit more - you should follow this issue square/retrofit#3075

from eithernet.

Kshitij09 avatar Kshitij09 commented on July 20, 2024

So currently there's no way we can handle 204 No content return type ?

from eithernet.

ZacSweers avatar ZacSweers commented on July 20, 2024

As explained at length in the comment above, no.

from eithernet.

Related Issues (19)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.