KatsuteDev/Mal4J

Android native `PATCH` support

Katsute opened this issue · 4 comments

Prerequisites

  • I have checked that no other similar feature request already exists.
  • I have checked discussions.
  • This feature request makes sense for the project.
  • I have checked that this feature does not already exist.
  • I am running the latest release version.

Feature

Full PATCH support for Android.

Related:

Note: Low-prio feature, no expected fix date until we can figure out how we can test reflection on all Android versions

Reason

This is the only feature that differs from the Java and Android library implementations.

Technically fixed by #220, this may break if MyAnimeList ceases to support X-HTTP-Method-Override

Could be achieved by modifying HttpUrlConnection#method field
https://github.com/adoptium/jdk8u/blob/d91ee59b3c8cd76b945b517336351f496ab3ff56/jdk/src/share/classes/java/net/HttpURLConnection.java#L75

should be compatible with Android since it shouldn't require the highly volatile Field class.

Drop methods and modifiers from existing and replace it with method only. Will need to check each Android SDK version to make sure that the method field will exist.

Does not work because HttpsUrlConnection is using a delegate which can only be set by using the setRequestMethod. This class differs across all Android versions.

Might only be possible by having a separate patch library that Android users can install into Mal4J.

(path, method, params<,>) => json override the call method

Possible security risk?