Skip to content

Request execution is always POST on Android #2301

@QYF-RYCBStudio

Description

@QYF-RYCBStudio

Describe the bug
Hi there,
The method RestClient.ExecuteAsync(RestRequest request) including Get/GetAsync always sends a POST request instead of a GET one, only happens on Android.
I have explicitly set the method GET, but it just sent a POST. You can see in the log that my local settings were right, so it was proved that it may be changed when transmitting. I have ensured that the API is OK.

To Reproduce
Occurs when sending GET requests on Android.
Because except my android app other programs (including Postman and Reqable Android when requesting) runs well, I only have to find them in the log:Github Gist

Expected behavior
It should send a GET request instead of a POST one. The image below shows the correct response:
Image

Desktop

  • OS: Android 15 (API Version 35)
  • .NET: .NET 9 and .NET 9-Android
  • Version: RestSharp 112.1.0
  • Avalonia 11.3.7
  • Avalonia.Android 11.3.7

Additional context
I have googled and I knew that it might be caused by the setDoOutput(true) in java.net.HttpURLConnection in Java Android developing, but I don't know if that works the same in .NET and I couldn't debug anymore because the ANR happened.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions