Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(android) Use X-HTTP-Method-Override when PATCH is not available #220

Merged
merged 5 commits into from
Sep 1, 2021

Conversation

Katsute
Copy link
Member

@Katsute Katsute commented Aug 28, 2021

Prerequisites

If checks are not passed then the pull request will be closed.

  • I have checked that no other similar pull request already exists.
  • My code follows the general code style as the rest of the code.
  • I have checked that no sensitive information is exposed.
  • Build compiles.
  • Build passes test cases.
  • I have added/modified documentation.
  • I have added/modified test cases.

Workflow Run: The link to the MyAnimeList CI workflow run for your branch. Check README for guide on remote tests.

Changes Made

List any changes made and/or other relevant issues.

  • Replaces
    conn.setRequestMethod(method);
    with
    // set request method
    try{
        conn.setRequestMethod(method);
    }catch(final ProtocolException ignored){
        // MyAnimeList API supports `X-HTTP-Method-Override`
        conn.setRequestMethod("POST");
        conn.setRequestProperty("X-HTTP-Method-Override", "PATCH");
    }
  • Removes most exceptions in static block
  • Uses try catch on request method in case Android supports PATCH

@Katsute Katsute added this to the 2.4.0 milestone Aug 28, 2021
@Katsute Katsute self-assigned this Aug 28, 2021
@Katsute
Copy link
Member Author

Katsute commented Aug 28, 2021

Wrong version

@Katsute Katsute changed the title (android) Add PATCH support for all versions 🚫 (android) Add PATCH support for all versions Aug 28, 2021
@Katsute Katsute changed the title 🚫 (android) Add PATCH support for all versions (android) Full compatibility Aug 29, 2021
@Katsute Katsute changed the title (android) Full compatibility (android) Use X-HTTP-Method-Override when PATCH is not available Aug 29, 2021
@Katsute Katsute merged commit 16aa90f into main Sep 1, 2021
@Katsute Katsute deleted the header-method-override@a62d684 branch September 1, 2021 02:43
@Katsute Katsute mentioned this pull request Apr 17, 2022
5 tasks
Katsute added a commit that referenced this pull request Jul 22, 2022
)

* PATCH for all!

* Update AndroidCompatibilityException.java

* switch to try catch on setRequestMethod (android may support patch)

* Update APICall.java

* Update APICall.java
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant