I'm using RxJava 2 & Retrofit 2 (https://github.com/JakeWharton/retrofit2-rxjava2-adapter) and I was wondering how to handle no response (204) type.
In rxjava1 i was using Observable<Void> but it's not allowed by rxjava2 anymore (https://github.com/ReactiveX/RxJava/wiki/What's-different-in-2.0 -> Nulls)
Right now, i've hacked around to bypass Json parsing on a custom type (I called it NoContent) but I was wondering if there is a better way.
EDIT:
public class NoContent {
public static class GsonTypeAdapter extends TypeAdapter<NoContent> {
@Override
public void write(JsonWriter out, NoContent value) throws IOException {
out.nullValue();
}
@Override
public NoContent read(JsonReader in) throws IOException {
return new NoContent();
}
}
}